diff --git a/roles/dehydrated/tasks/main.yml b/roles/dehydrated/tasks/main.yml index 74102e6..d9523dc 100644 --- a/roles/dehydrated/tasks/main.yml +++ b/roles/dehydrated/tasks/main.yml @@ -20,8 +20,23 @@ ansible.builtin.template: src: /templates/domains.txt.j2 dest: "{{ dehydrated_config }}/domains.txt" + register: dehydomains - name: Ensure config is present. ansible.builtin.template: src: /templates/config.j2 dest: "{{ dehydrated_config }}/config" + register: dehyconfig + +- name: Create wellknown directory. + file: + state: directory + path: /var/www/letsencrypt + +- name: Register account. + command: "{{ dehydrated_path }} --register --accept-terms" + when: dehyconfig.changed + +- name: Initial dehydrated run. + command: "{{ dehydrated_path }} --cron" + when: dehyconfig.changed or dehydomains.changed