ansible-role-apache_ssl_vhosts/tasks/main.yml

27 lines
615 B
YAML
Raw Normal View History

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:47:57 +01:00
- name: Initialize need_certificate
set_fact:
need_certificate: false
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: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-02-09 19:45:30 +01:00
when: need_certificate