-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhancement: More flexible per-domain hooks
Added per-domain deploy hooks Added possibility to add arbitrary content to pre/post/deploy hook shell scripts per domain
- Loading branch information
Showing
8 changed files
with
99 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,6 +96,10 @@ certbot_netcup_certs: [] | |
# email: [email protected] | ||
# services: | ||
# - nginx | ||
# pre_hook_additional_content: "" | ||
# post_hook_additional_content: "" | ||
# deploy_hook_additional_content: | | ||
# postfix reload | ||
# - domains: | ||
# - example2.com | ||
``` | ||
|
@@ -109,6 +113,8 @@ One certificate file will be created per entry in `certbot_netcup_certs`. | |
|
||
`services` is a list of services to stop before certificate renewal and start again after. From these services a shell script as `pre` and `post` hook is created. | ||
|
||
`pre_hook_additional_content`, `post_hook_additional_content`, `deploy_hook_additional_content` are strings that represent additional content to be written to the corresponding hook shell scripts. This gives the flexibility to perform tasks other than starting or stopping services. The example above reloads the Postfix configfuration to refresh TLS certificates after renewal without Postfix downtime. | ||
|
||
```yaml | ||
certbot_cloudflare_acme_server: "{{ certbot_cloudflare_acme_test }}" | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,10 @@ certbot_netcup_certs: [] | |
# - email: [email protected] | ||
# services: | ||
# - nginx | ||
# pre_hook_additional_content: "" | ||
# post_hook_additional_content: "" | ||
# deploy_hook_additional_content: | | ||
# postfix reload | ||
# domains: | ||
# - local.example.com | ||
# - *.local.example.com | ||
|
@@ -44,11 +48,14 @@ certbot_create_command: >- | |
--email {{ cert_item.email | default(certbot_netcup_admin_email) }} | ||
{{ certbot_netcup_create_extra_args }} | ||
-d {{ cert_item.domains | join(',') }} | ||
{{ '--pre-hook /etc/letsencrypt/domain-renewal-hooks/' + first_domain + '/stop_services.sh' | ||
if cert_item.services is defined and cert_item.services | ||
{{ '--pre-hook /etc/letsencrypt/domain-renewal-hooks/' + first_domain + '/pre_hook.sh' | ||
if (cert_item.services is defined and cert_item.services) or (cert_item.pre_hook_additional_content is defined and cert_item.pre_hook_additional_content | length > 0) | ||
else '' }} | ||
{{ '--post-hook /etc/letsencrypt/domain-renewal-hooks/' + first_domain + '/stop_services.sh' | ||
if cert_item.services is defined and cert_item.services | ||
{{ '--post-hook /etc/letsencrypt/domain-renewal-hooks/' + first_domain + '/post_hook.sh' | ||
if (cert_item.services is defined and cert_item.services) or (cert_item.post_hook_additional_content is defined and cert_item.post_hook_additional_content | length > 0) | ||
else '' }} | ||
{{ '--deploy-hook /etc/letsencrypt/domain-renewal-hooks/' + first_domain + '/deploy_hook.sh' | ||
if cert_item.deploy_hook_additional_content is defined and cert_item.deploy_hook_additional_content | length > 0 | ||
else '' }} | ||
# Extra arguments to pass to certbot when creating a certificate | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
# {{ ansible_managed }} | ||
|
||
{{ certbot_netcup_domain_deploy_hook_additional_content }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters