ansible-role-apache_ssl_vhosts/tasks/main.yml
2023-02-09 20:48:58 +02:00

26 lines
615 B
YAML

---
- name: Ensure installation
include_tasks: install.yml
- name: Ensure configuration
include_tasks: configure.yml
- name: Get certificate file
stat:
path: "/etc/letsencrypt/archive/{{ item.vhostname }}"
register: certificate_folder
loop: "{{ vhosts }}"
- name: Initialize need_certificate
set_fact:
need_certificate: false
- name: Evaluate if need certificate
set_fact:
need_certificate: true
when: not item.stat.exists
loop: "{{ certificate_folder.results }}"
- name: Ensure certificate is created if needed
include_tasks: configure_certificate.yml
when: need_certificate