ansible-role-apache_ssl_vhosts/tasks/configure_certificate.yml

16 lines
416 B
YAML

---
- 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 --apache -d {{ item.vhostname }}"
args:
creates: "/etc/letsencrypt/archive/{{ item.vhostname }}"
when:
- "'ssl' in item"
- item.ssl
loop: "{{ vhosts }}"