2018-06-22 19:18:48 +00:00
|
|
|
---
|
2019-09-18 14:37:54 +00:00
|
|
|
- block:
|
2018-06-22 19:18:48 +00:00
|
|
|
- name: Install certbot
|
|
|
|
package:
|
2019-09-18 14:37:54 +00:00
|
|
|
name: "{{ item }}"
|
2018-06-22 19:18:48 +00:00
|
|
|
state: present
|
2019-09-18 14:37:54 +00:00
|
|
|
loop: "{{ certbot_packages_extra + __certbot_packages }}"
|
|
|
|
|
|
|
|
- name: Create certbot user '{{ certbot_user }}'
|
|
|
|
user:
|
|
|
|
name: "{{ certbot_user }}"
|
|
|
|
become: True
|
|
|
|
become_user: root
|
|
|
|
when: not certbot_user == 'root'
|
|
|
|
become: True
|
|
|
|
become_user: root
|
2018-06-22 19:18:48 +00:00
|
|
|
|
2019-09-18 14:37:54 +00:00
|
|
|
- block:
|
2018-06-22 19:18:48 +00:00
|
|
|
- name: Create certbot environment
|
2018-06-22 19:39:52 +00:00
|
|
|
file:
|
|
|
|
path: "{{ item.name }}"
|
2018-06-22 19:18:48 +00:00
|
|
|
state: directory
|
2018-06-22 19:39:52 +00:00
|
|
|
mode: "{{ item.mode }}"
|
2019-09-18 13:28:46 +00:00
|
|
|
loop: "{{ certbot_environment }}"
|
2018-06-22 19:45:25 +00:00
|
|
|
loop_control:
|
|
|
|
label: "{{ item.name }}"
|
2018-06-22 19:18:48 +00:00
|
|
|
|
|
|
|
- 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
|
2019-10-30 21:44:26 +00:00
|
|
|
minute: "55"
|
|
|
|
hour: "3"
|
2018-06-22 21:16:49 +00:00
|
|
|
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
|
2018-06-22 19:18:48 +00:00
|
|
|
become: True
|
|
|
|
become_user: "{{ certbot_user }}"
|