optionally create user and setup directories

This commit is contained in:
Robert Kaussow 2018-06-22 21:18:48 +02:00
parent 289faf4905
commit 96e17c50a3
3 changed files with 38 additions and 0 deletions

9
defaults/main.yml Normal file
View File

@ -0,0 +1,9 @@
---
certbot_work_dir: /var/lib/letsencrypt
certbot_config_dir: /etc/letsencrypt
certbot_log_dir: /var/log/letsencrypt
certbot_environment:
- {{ certbot_work_dir }}
- {{ certbot_config }}
- {{ certbot_log_dir }}
certbot_user: root

27
tasks/install.yml Normal file
View File

@ -0,0 +1,27 @@
---
- name: Create certbot user '{{ certbot_user }}'
user:
name: "{{ certbot_user }}"
become: True
become_user: root
when: not certbot_user == root
- name: Deploy certbot
block:
- name: Install certbot
package:
name: certbot
state: present
- name: Create certbot environment
path: /etc/some_directory
state: directory
mode: 0755
with_items: "{{ certbot_environment }}"
- name: Deploy config file
template:
src: etc/ssh/sshd_config.j2
dest: /etc/ssh/sshd_config
become: True
become_user: "{{ certbot_user }}"

2
tasks/main.yml Normal file
View File

@ -0,0 +1,2 @@
---
- include_tasks: install.yml