From 88d1f3ab72a7974bc7d80af8d61736548a67d71b Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 12 Sep 2018 19:04:46 +0200 Subject: [PATCH] Run the hook only if the mongodb.pem file does not exist. --- mongodb-org/tasks/mongodb-letsencrypt-acmetool.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mongodb-org/tasks/mongodb-letsencrypt-acmetool.yml b/mongodb-org/tasks/mongodb-letsencrypt-acmetool.yml index 40134ae..58d8b2a 100644 --- a/mongodb-org/tasks/mongodb-letsencrypt-acmetool.yml +++ b/mongodb-org/tasks/mongodb-letsencrypt-acmetool.yml @@ -6,8 +6,13 @@ - name: Install a script that fix the letsencrypt certificate for mongodb and then reload the service template: src=mongodb-letsencrypt-acmetool.sh dest={{ letsencrypt_acme_services_scripts_dir }}/mongodb owner=root group=root mode=4555 + - name: Verify if the mongodb pem file exists + stat: path={{ mongodb_ssl_certkey_file }} + register: mongodb_pem + - name: Copy the certificate and its key where the mongo server expects it command: "{{ letsencrypt_acme_services_scripts_dir }}/mongodb" + when: mongodb_pem.stat.exists when: - mongodb_ssl_letsencrypt_managed