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
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