Trigger hooks after certificate renewal #6

Merged
hgo merged 9 commits from 5-trigger-hooks-after-certificate-renewal into master 2020-12-30 14:17:28 +01:00
2 changed files with 8 additions and 2 deletions
Showing only changes of commit 3d975b1f17 - Show all commits

View File

@ -308,7 +308,11 @@ class Domain(PrivateKey):
def run_hooks(self) -> None: def run_hooks(self) -> None:
for hook in self.hooks: for hook in self.hooks:
logging.info(f"Running hook: '{hook}'") logging.info(f"Running hook: '{hook}'")
subprocess.run(hook.split()) hook_res = subprocess.run(hook.split(),
stdout=subprocess.DEVNULL,
stderr=subprocess.PIPE)
if hook_res.returncode != 0:
logging.error(f"Unable to run hook: {hook_res.stderr}")
def main(): def main():

View File

@ -84,7 +84,9 @@
tags: acme_install tags: acme_install
- name: Perform ACME challenge for each domain - name: Perform ACME challenge for each domain
command: acme-renew-cert -v -c {{ acme_config_file | quote }} command: acme-renew-cert -c {{ acme_config_file | quote }}
changed_when: "'No domain to renew' not in _acme_challenge.stdout"
register: _acme_challenge
tags: acme_challenge tags: acme_challenge
- name: Setup cron job for ACME certificates renewal of {{ domain_name }} - name: Setup cron job for ACME certificates renewal of {{ domain_name }}