From 1411e392bea9c87efe4015f1b1fcac96c68778c9 Mon Sep 17 00:00:00 2001 From: nierdz Date: Sun, 27 Dec 2020 13:15:26 +0100 Subject: [PATCH] Use more specific services to stop/start during cert creation process This is useful when you need to stop different services depending on the certificates. For example, if you have a first certificate that uses varnish and a second one using nginx you can have a configuration that looks like this: certbot_certs: - email: janedoe@example.com stop_services: - varnish domains: - example1.com - email: janedoe@example.com stop_services: - nginx domains: - example2.com This way, you don't have to stop both varnish and nginx during cert creation process. --- tasks/create-cert-standalone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/create-cert-standalone.yml b/tasks/create-cert-standalone.yml index 6f25b8a..7db9674 100644 --- a/tasks/create-cert-standalone.yml +++ b/tasks/create-cert-standalone.yml @@ -9,7 +9,7 @@ name: "{{ item }}" state: stopped when: not letsencrypt_cert.stat.exists - with_items: "{{ certbot_create_standalone_stop_services }}" + with_items: "{{ cert_item.stop_services | default(certbot_create_standalone_stop_services) }}" - name: Generate new certificate if one doesn't exist. command: "{{ certbot_create_command }}" @@ -20,4 +20,4 @@ name: "{{ item }}" state: started when: not letsencrypt_cert.stat.exists - with_items: "{{ certbot_create_standalone_stop_services }}" + with_items: "{{ cert_item.stop_services | default(certbot_create_standalone_stop_services) }}"