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-09-24 09:12:28 +02:00
|
|
|
when:
|
2023-09-24 09:14:58 +02:00
|
|
|
- ssl
|
|
|
|
- item.ssl
|
2023-02-09 19:40:08 +01:00
|
|
|
|
2023-02-09 19:47:57 +01:00
|
|
|
- name: Initialize need_certificate
|
|
|
|
set_fact:
|
|
|
|
need_certificate: false
|
2023-09-24 08:49:05 +02:00
|
|
|
when: ssl
|
2023-02-09 19:47:57 +01:00
|
|
|
|
2023-02-09 19:45:30 +01:00
|
|
|
- name: Evaluate if need certificate
|
|
|
|
set_fact:
|
|
|
|
need_certificate: true
|
2023-09-24 08:49:05 +02:00
|
|
|
when:
|
2023-09-24 09:30:55 +02:00
|
|
|
- "'stat' in item"
|
2023-09-24 08:49:05 +02:00
|
|
|
- not item.stat.exists
|
|
|
|
- ssl
|
2023-09-24 09:12:28 +02:00
|
|
|
- item.ssl
|
2023-02-09 19:46:38 +01:00
|
|
|
loop: "{{ certificate_folder.results }}"
|
2023-02-09 19:45:30 +01:00
|
|
|
|
2023-02-09 19:48:58 +01:00
|
|
|
- name: Ensure certificate is created if needed
|
2023-02-09 19:40:08 +01:00
|
|
|
include_tasks: configure_certificate.yml
|
2023-09-24 09:33:00 +02:00
|
|
|
when:
|
|
|
|
- ssl
|
|
|
|
- need_certificate
|