diff --git a/tasks/configure_certificate.yml b/tasks/configure_certificate.yml index 22a89d4..cd37323 100644 --- a/tasks/configure_certificate.yml +++ b/tasks/configure_certificate.yml @@ -1,19 +1,16 @@ --- -- name: Stop Apache - service: - name: apache2 - state: stopped +- name: Ensure certbot software is installed + package: + name: + - certbot + - python3-certbot-apache + state: latest - name: Ensure SSL certificate exists - shell: "certbot certonly --agree-tos --email certs@susurrando.com -n --standalone -d {{ item.vhostname }}" + shell: "certbot certonly --agree-tos --email certs@susurrando.com -n --apache -d {{ item.vhostname }}" args: creates: "/etc/letsencrypt/archive/{{ item.vhostname }}" when: - "'ssl' in item" - item['ssl'] loop: "{{ vhosts }}" - -- name: Start Apache - service: - name: apache2 - state: started