Makes a single systcmtl call in pre- and post-renewal hooks

This commit is contained in:
Frank Sachsenheim 2020-12-18 16:37:19 +01:00
parent 2da7a3f2b6
commit 878c8e2664
2 changed files with 12 additions and 8 deletions

View File

@ -1,11 +1,12 @@
#!/bin/bash #!/bin/sh
# {{ ansible_managed }} # {{ ansible_managed }}
{% if ansible_service_mgr == 'systemd' %}
systemctl start {{ certbot_create_standalone_stop_services | join(" ") }}
{% else %}
{% for item in certbot_create_standalone_stop_services %} {% for item in certbot_create_standalone_stop_services %}
echo "starting service {{ item }}" echo "starting service {{ item }}"
{% if ansible_service_mgr == 'systemd' %} {% if ansible_service_mgr == 'upstart' %}
systemctl start {{ item }}
{% elif ansible_service_mgr == 'upstart' %}
initctl start {{ item }} initctl start {{ item }}
{% elif ansible_service_mgr == 'openrc' %} {% elif ansible_service_mgr == 'openrc' %}
rc-service {{ item }} start rc-service {{ item }} start
@ -13,3 +14,4 @@ rc-service {{ item }} start
service {{ item }} start service {{ item }} start
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %}

View File

@ -1,11 +1,12 @@
#!/bin/bash #!/bin/sh
# {{ ansible_managed }} # {{ ansible_managed }}
{% if ansible_service_mgr == 'systemd' %}
systemctl stop {{ certbot_create_standalone_stop_services | join(" ") }}
{% else %}
{% for item in certbot_create_standalone_stop_services %} {% for item in certbot_create_standalone_stop_services %}
echo "stopping service {{ item }}" echo "stopping service {{ item }}"
{% if ansible_service_mgr == 'systemd' %} {% if ansible_service_mgr == 'upstart' %}
systemctl stop {{ item }}
{% elif ansible_service_mgr == 'upstart' %}
initctl stop {{ item }} initctl stop {{ item }}
{% elif ansible_service_mgr == 'openrc' %} {% elif ansible_service_mgr == 'openrc' %}
rc-service {{ item }} stop rc-service {{ item }} stop
@ -13,3 +14,4 @@ rc-service {{ item }} stop
service {{ item }} stop service {{ item }} stop
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %}