From 60a6470a6921b2e4dbed41b95110aa4e963be947 Mon Sep 17 00:00:00 2001 From: Romina Brown Date: Wed, 15 Apr 2026 16:12:26 -0300 Subject: [PATCH] Change pre/post hook templates --- README.md | 5 +++++ defaults/main.yml | 3 +++ tasks/create-cert-standalone.yml | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 40d147a..024d5d0 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,11 @@ Services that should be stopped while `certbot` runs it's own standalone server These services will only be stopped the first time a new cert is generated. + certbot_pre_hook_template: stop_services.j2 + certbot_post_hook_template: start_services.j2 + +If you need to stop and start services in another way, firstly you define these services in `certbot_create_standalone_stop_services` and then you must create your own templates for this mision and set its paths in `certbot_pre_hook_template` and `certbot_post_hook_template`. + ### Snap Installation Beginning in December 2020, the Certbot maintainers decided to recommend installing Certbot from Snap rather than maintain scripts like `certbot-auto`. diff --git a/defaults/main.yml b/defaults/main.yml index 3f29db0..b6d9e0f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -68,3 +68,6 @@ certbot_keep_updated: true # Where to put Certbot when installing from source. certbot_dir: /opt/certbot + +certbot_pre_hook_template: stop_services.j2 +certbot_post_hook_template: start_services.j2 \ No newline at end of file diff --git a/tasks/create-cert-standalone.yml b/tasks/create-cert-standalone.yml index c04eb52..77d86f3 100644 --- a/tasks/create-cert-standalone.yml +++ b/tasks/create-cert-standalone.yml @@ -21,7 +21,7 @@ - name: Create pre hook to stop services. template: - src: stop_services.j2 + src: "{{ certbot_pre_hook_template }}" dest: /etc/letsencrypt/renewal-hooks/pre/stop_services owner: root group: root @@ -32,7 +32,7 @@ - name: Create post hook to start services. template: - src: start_services.j2 + src: "{{ certbot_post_hook_template }}" dest: /etc/letsencrypt/renewal-hooks/post/start_services owner: root group: root