From 799d8d3c6e72e4a8cb2dc7f41ba6da269ea06f8e Mon Sep 17 00:00:00 2001 From: "Antonio J. Delgado" Date: Sat, 28 Jan 2023 00:51:14 +0200 Subject: [PATCH] add check for either certificate missing --- tasks/configure_prometheus_exporters_external.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tasks/configure_prometheus_exporters_external.yml b/tasks/configure_prometheus_exporters_external.yml index b8bbf47..65f7999 100644 --- a/tasks/configure_prometheus_exporters_external.yml +++ b/tasks/configure_prometheus_exporters_external.yml @@ -53,13 +53,21 @@ state: present name: authnz_external # Add DNS entries in OVH + - name: Check if certificates exist stat: path: "/etc/letsencrypt/live/node-metrics-{{ ansible_fqdn }}/fullchain.pem" register: node_certificate + +- name: Check if postfix certificates exist + stat: + path: "/etc/letsencrypt/live/postfix-metrics-{{ ansible_fqdn }}/fullchain.pem" + register: postfix_certificate + - name: Request certificates for node and postfix include_tasks: configure_prometheus_exporters_certificates.yml - when: not node_certificate.stat.exists + when: not node_certificate.stat.exists or not postfix_certificate.stat.exists + - name: Ensure virtual hosts configuration is deployed template: src: templates/apache2.conf.j2 @@ -74,4 +82,4 @@ - name: Start Apache2 after request certificate service: name: apache2 - state: started \ No newline at end of file + state: started