xoxys.certbot/tasks/install.yml

46 lines
1.2 KiB
YAML
Raw Normal View History

---
- name: Create certbot user '{{ certbot_user }}'
user:
name: "{{ certbot_user }}"
become: True
become_user: root
2018-06-22 19:43:16 +00:00
when: not certbot_user == 'root'
- name: Deploy certbot
block:
- name: Install certbot
package:
name: certbot
state: present
- name: Create certbot environment
2018-06-22 19:39:52 +00:00
file:
path: "{{ item.name }}"
state: directory
2018-06-22 19:39:52 +00:00
mode: "{{ item.mode }}"
with_items: "{{ certbot_environment }}"
2018-06-22 19:45:25 +00:00
loop_control:
label: "{{ item.name }}"
- name: Deploy config file
template:
2018-06-22 19:59:02 +00:00
src: config/cli.ini.j2
2018-06-22 20:50:24 +00:00
dest: "{{ certbot_config_dir }}/cli.ini"
2018-06-22 21:16:49 +00:00
- name: Schedule certbot run
cron:
name: certbot - letsencrypt certs renewal
minute: 55
hour: 3
user: "{{ certbot_user }}"
2018-06-26 19:09:16 +00:00
job: >
2018-06-26 19:11:52 +00:00
certbot
2018-06-23 16:37:26 +00:00
--config-dir {{ certbot_config_dir }}
--work-dir {{ certbot_work_dir }}
--logs-dir {{ certbot_log_dir }}
2018-06-26 19:11:52 +00:00
{{ certbot_command_arguments | join(' ') }}
2018-06-22 21:16:49 +00:00
cron_file: "{{ certbot_cronfile | default(omit) }}"
2018-06-23 18:43:04 +00:00
when: certbot_scheduler_enabled
become: True
become_user: "{{ certbot_user }}"