Robert Kaussow
f35134612d
All checks were successful
continuous-integration/drone/push Build is passing
56 lines
1.5 KiB
YAML
56 lines
1.5 KiB
YAML
---
|
|
- block:
|
|
- name: Install certbot
|
|
package:
|
|
name: "{{ item }}"
|
|
state: present
|
|
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
|
|
|
|
- block:
|
|
- name: Create certbot environment
|
|
file:
|
|
path: "{{ item.name }}"
|
|
state: directory
|
|
mode: "{{ item.mode }}"
|
|
loop: "{{ __certbot_environment }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
|
|
- name: Deploy config file
|
|
template:
|
|
src: config/cli.ini.j2
|
|
dest: "{{ certbot_config_dir }}/cli.ini"
|
|
|
|
- name: Deploy credentials file
|
|
template:
|
|
src: config/credentials.ini.j2
|
|
dest: "{{ certbot_config_dir }}/credentials.ini"
|
|
mode: 600
|
|
when: certbot_credentials
|
|
|
|
- name: Schedule certbot run
|
|
cron:
|
|
name: Certbot automatic renewal
|
|
minute: "{{ certbot_cron_minute }}"
|
|
hour: "{{ certbot_cron_hour }}"
|
|
user: "{{ certbot_cron_user | default(certbot_user) }}"
|
|
job: >
|
|
certbot
|
|
--config-dir {{ certbot_config_dir }}
|
|
--work-dir {{ certbot_work_dir }}
|
|
--logs-dir {{ certbot_log_dir }}
|
|
{{ certbot_command_arguments | join(' ') }}
|
|
cron_file: "{{ certbot_cron_file | default(omit) }}"
|
|
when: certbot_cron_enabled
|
|
become: True
|
|
become_user: "{{ certbot_user }}"
|