xoxys.certbot/tasks/install.yml

56 lines
1.5 KiB
YAML
Raw Normal View History

---
2019-09-18 14:37:54 +00:00
- block:
- name: Install certbot
package:
2019-09-18 14:37:54 +00:00
name: "{{ item }}"
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
2019-09-18 14:37:54 +00:00
- block:
- 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 }}"
2019-09-18 13:28:46 +00:00
loop: "{{ 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
2020-04-19 21:27:41 +00:00
- name: Deploy credentials file
template:
src: config/credentials.ini.j2
dest: "{{ certbot_config_dir }}/credentials.ini"
when: certbot_credentials
mode: 600
2018-06-22 21:16:49 +00:00
- name: Schedule certbot run
cron:
2020-04-19 21:27:41 +00:00
name: Certbot automatic renewal
minute: "{{ certbot_cron_minute }}"
hour: "{{ certbot_cron_hour }}"
user: "{{ certbot_cron_user | default(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(' ') }}
2020-04-19 21:27:41 +00:00
cron_file: "{{ certbot_cron_file | default(omit) }}"
2018-06-23 18:43:04 +00:00
when: certbot_scheduler_enabled
become: True
become_user: "{{ certbot_user }}"