2022-10-11 09:18:51 +02:00
|
|
|
---
|
|
|
|
- name: Ensure installation
|
|
|
|
include_tasks: install.yml
|
2023-02-09 19:40:08 +01:00
|
|
|
|
2022-10-11 09:18:51 +02:00
|
|
|
- name: Ensure configuration
|
2023-02-09 19:40:08 +01:00
|
|
|
include_tasks: configure.yml
|
|
|
|
|
|
|
|
- name: Get certificate file
|
|
|
|
stat:
|
|
|
|
path: "/etc/letsencrypt/archive/{{ item.vhostname }}"
|
|
|
|
register: certificate_folder
|
2023-02-09 19:42:32 +01:00
|
|
|
loop: "{{ vhosts }}"
|
2023-02-09 19:40:08 +01:00
|
|
|
|
2023-02-09 19:45:30 +01:00
|
|
|
- name: Evaluate if need certificate
|
|
|
|
set_fact:
|
|
|
|
need_certificate: true
|
|
|
|
when: not item.stat.exists
|
2023-02-09 19:46:38 +01:00
|
|
|
loop: "{{ certificate_folder.results }}"
|
2023-02-09 19:45:30 +01:00
|
|
|
|
2023-02-09 19:40:08 +01:00
|
|
|
- name: Ensure certificate is created
|
|
|
|
include_tasks: configure_certificate.yml
|
2023-02-09 19:45:30 +01:00
|
|
|
when: need_certificate
|