ansible-role-apache_ssl_vhosts/tasks/configure_certificate.yml

20 lines
430 B
YAML
Raw Normal View History

2023-02-09 19:40:08 +01:00
---
- 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']
2023-02-09 19:42:32 +01:00
loop: "{{ vhosts }}"
2023-02-09 19:40:08 +01:00
- name: Start Apache
service:
name: apache2
state: started