chore(lego): allow for lego_post_renewal_script to be array of commands/hooks

This commit is contained in:
transcaffeine 2024-06-23 12:08:32 +02:00
parent 056b896083
commit 7c42199b1e
No known key found for this signature in database
GPG key ID: 03624C433676E465

View file

@ -24,8 +24,16 @@ ExecStartPost=+-/bin/sh -c 'chmod 0640 {{ lego_certificate_store }}/*'
ExecStartPost=+-/usr/bin/python3 {{ lego_base_path }}/metrics-textfile.py
{% endif %}
{% if lego_post_renewal_script is defined %}
{# see https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_tests.html#type-tests #}
{# list is not string or mapping but iterable #}
{% if lego_post_renewal_script is not string and lego_post_renewal_script is not mapping and lego_post_renewal_script is iterable and lego_post_renewal_script | length > 0 %}
{% for hook in lego_post_renewal_script %}
ExecStartPost=+-{{ hook }}
{% endfor %}
{% else %}
ExecStartPost=+-{{ lego_post_renewal_script }}
{% endif %}
{% endif %}
[Install]
WantedBy=multi-user.target