use certbot plugin for apache

This commit is contained in:
Antonio J. Delgado 2023-05-09 10:24:11 +03:00
parent 0dfc47f0db
commit 751a0aebec

View file

@ -1,19 +1,16 @@
--- ---
- name: Stop Apache - name: Ensure certbot software is installed
service: package:
name: apache2 name:
state: stopped - certbot
- python3-certbot-apache
state: latest
- name: Ensure SSL certificate exists - 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: args:
creates: "/etc/letsencrypt/archive/{{ item.vhostname }}" creates: "/etc/letsencrypt/archive/{{ item.vhostname }}"
when: when:
- "'ssl' in item" - "'ssl' in item"
- item['ssl'] - item['ssl']
loop: "{{ vhosts }}" loop: "{{ vhosts }}"
- name: Start Apache
service:
name: apache2
state: started