diff --git a/CHANGELOG.md b/CHANGELOG.md index 811bdb8..b40f214 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/) ### Changed - test: replace kitchen to molecule +- chore: use FQCN for module name ### Removed diff --git a/tasks/base.yml b/tasks/base.yml index f7bea98..04f5e7d 100644 --- a/tasks/base.yml +++ b/tasks/base.yml @@ -1,17 +1,15 @@ --- - name: install certbot package - apt: - name: '{{ packages }}' - default_release: '{{ certbot_distribution|default(ansible_distribution_release) }}' - state: present - vars: - packages: + ansible.builtin.apt: + name: - certbot - cron + default_release: '{{ certbot_distribution|default(ansible_distribution_release) }}' + state: present tags: certbot - name: create webroot path directory - file: + ansible.builtin.file: path: '{{ certbot_path }}' owner: root group: root @@ -20,7 +18,7 @@ tags: certbot - name: install certbot-renew binary - copy: + ansible.builtin.copy: src: certbot-renew dest: /usr/local/bin/certbot-renew owner: root @@ -29,7 +27,7 @@ tags: certbot - name: install certbot renew configuration - template: + ansible.builtin.template: src: renew.cfg.j2 dest: /etc/letsencrypt/renew.cfg owner: root @@ -38,16 +36,16 @@ tags: certbot - name: remove old cerbot renew cron - file: + ansible.builtin.file: path: /etc/cron.d/certbot state: absent tags: certbot - name: add certbot renew cron - cron: + ansible.builtin.cron: name: certbot-renew user: root hour: '*/12' - minute: 0 + minute: '0' job: perl -e 'sleep int(rand(3600))' && certbot -q renew --renew-hook /usr/local/bin/certbot-renew tags: certbot diff --git a/tasks/certificates.yml b/tasks/certificates.yml index 5324437..bed4e94 100644 --- a/tasks/certificates.yml +++ b/tasks/certificates.yml @@ -1,19 +1,19 @@ --- - name: check if certificate exist - stat: + ansible.builtin.stat: path: '/etc/letsencrypt/live/{{ item.name }}' loop: '{{ certbot_domains }}' register: st tags: certbot - name: check if nginx is launch - stat: + ansible.builtin.stat: path: /var/run/nginx.pid register: ng tags: certbot - name: create a new certificate - command: > + ansible.builtin.command: > certbot certonly -n --agree-tos -d {{ item.item.name }} -m {{ certbot_mail }} --webroot --webroot-path {{ certbot_path }} --rsa-key-size {{ certbot_key_size }} loop: '{{ st.results }}' @@ -21,7 +21,7 @@ tags: certbot - name: create a new certificate (standalone) - command: > + ansible.builtin.command: > certbot certonly -n --agree-tos -d {{ item.item.name }} -m {{ certbot_mail }} --standalone --rsa-key-size {{ certbot_key_size }} loop: '{{ st.results }}'