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.
This commit is contained in:
nierdz 2020-12-27 13:15:26 +01:00
parent b96acd79ec
commit 1411e392be

View File

@ -9,7 +9,7 @@
name: "{{ item }}" name: "{{ item }}"
state: stopped state: stopped
when: not letsencrypt_cert.stat.exists 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. - name: Generate new certificate if one doesn't exist.
command: "{{ certbot_create_command }}" command: "{{ certbot_create_command }}"
@ -20,4 +20,4 @@
name: "{{ item }}" name: "{{ item }}"
state: started state: started
when: not letsencrypt_cert.stat.exists 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) }}"