ansible-role-apache_ssl_vhosts/tasks/configure_certificate.yml
2023-02-09 20:42:32 +02:00

19 lines
430 B
YAML

---
- name: Stop Apache
service:
name: apache2
state: stopped
- name: Ensure SSL certificate exists
shell: "certbot certonly --agree-tos --email certs@susurrando.com -n --standalone -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