fix hook
Some checks failed
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/test Pipeline failed
ci/woodpecker/push/docs unknown status
ci/woodpecker/push/notify Pipeline was successful

This commit is contained in:
Robert Kaussow 2024-09-28 00:57:06 +02:00
parent cf5373f595
commit 65261b5953
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
2 changed files with 4 additions and 4 deletions

View File

@ -31,7 +31,7 @@
dest: "{{ __lego_base_dir }}/bin/hook-{{ item.name }}.sh" dest: "{{ __lego_base_dir }}/bin/hook-{{ item.name }}.sh"
owner: root owner: root
group: root group: root
mode: "0600" mode: "0700"
when: item.hook is defined when: item.hook is defined
loop: "{{ lego_certificates }}" loop: "{{ lego_certificates }}"
loop_control: loop_control:
@ -47,7 +47,7 @@
--dns="cloudflare" --dns="cloudflare"
{{ '--dns.resolvers="' + lego_dns_resolvers | join(',') + '"' if lego_dns_resolvers | length > 0 else '' }} {{ '--dns.resolvers="' + lego_dns_resolvers | join(',') + '"' if lego_dns_resolvers | length > 0 else '' }}
run run
{{ '--run-hook="hook-' + cert.name + '.sh"' if cert.hook is defined else '' }} {{ '--run-hook="' + __lego_base_dir + '/bin/hook-' + item.name + '.sh"' if item.hook is defined else '' }}
args: args:
creates: "{{ __lego_base_dir }}/.lego/certificates/{{ item.domains[0] }}.crt" creates: "{{ __lego_base_dir }}/.lego/certificates/{{ item.domains[0] }}.crt"
environment: environment:

View File

@ -1,4 +1,4 @@
#!/bin/env bash #!/usr/bin/env bash
# run this script daily to renew any letsencrypt certs that need renewing # run this script daily to renew any letsencrypt certs that need renewing
# renew cert if it expires within 30 days # renew cert if it expires within 30 days
@ -8,6 +8,6 @@ export CLOUDFLARE_DNS_API_TOKEN="{{ lego_cloudflare_api_token }}"
{% for cert in lego_certificates %} {% for cert in lego_certificates %}
echo "$(date) checking for cert update for {{ ', '.join(cert.domains) }}." echo "$(date) checking for cert update for {{ ', '.join(cert.domains) }}."
{{ __lego_bin_file }} --email="{{ lego_acme_account_email }}" --domains {{ ' --domains '.join(cert.domains) }} --key-type="{{ lego_key_type }}" --dns="cloudflare" {{ '--dns.resolvers="' + lego_dns_resolvers | join(',') + '"' if lego_dns_resolvers | length > 0 else '' }} renew {{ '--renew-hook="hook-' + cert.name + '.sh"' if cert.hook is defined else '' }} --days 30 {{ __lego_bin_file }} --email="{{ lego_acme_account_email }}" --domains {{ ' --domains '.join(cert.domains) }} --key-type="{{ lego_key_type }}" --dns="cloudflare" {{ '--dns.resolvers="' + lego_dns_resolvers | join(',') + '"' if lego_dns_resolvers | length > 0 else '' }} renew {{ '--run-hook="' + __lego_base_dir + '/bin/hook-' + cert.name + '.sh"' if cert.hook is defined else '' }} --days 30
{% endfor %} {% endfor %}