From 878c8e2664c93029360ce2bbfdee30cee87797ec Mon Sep 17 00:00:00 2001 From: Frank Sachsenheim Date: Fri, 18 Dec 2020 16:37:19 +0100 Subject: [PATCH] Makes a single systcmtl call in pre- and post-renewal hooks --- templates/start_services.j2 | 10 ++++++---- templates/stop_services.j2 | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/templates/start_services.j2 b/templates/start_services.j2 index ff1a21d..16787c4 100644 --- a/templates/start_services.j2 +++ b/templates/start_services.j2 @@ -1,11 +1,12 @@ -#!/bin/bash +#!/bin/sh # {{ ansible_managed }} +{% if ansible_service_mgr == 'systemd' %} +systemctl start {{ certbot_create_standalone_stop_services | join(" ") }} +{% else %} {% for item in certbot_create_standalone_stop_services %} echo "starting service {{ item }}" -{% if ansible_service_mgr == 'systemd' %} -systemctl start {{ item }} -{% elif ansible_service_mgr == 'upstart' %} +{% if ansible_service_mgr == 'upstart' %} initctl start {{ item }} {% elif ansible_service_mgr == 'openrc' %} rc-service {{ item }} start @@ -13,3 +14,4 @@ rc-service {{ item }} start service {{ item }} start {% endif %} {% endfor %} +{% endif %} diff --git a/templates/stop_services.j2 b/templates/stop_services.j2 index f087768..f6fa719 100644 --- a/templates/stop_services.j2 +++ b/templates/stop_services.j2 @@ -1,11 +1,12 @@ -#!/bin/bash +#!/bin/sh # {{ ansible_managed }} +{% if ansible_service_mgr == 'systemd' %} +systemctl stop {{ certbot_create_standalone_stop_services | join(" ") }} +{% else %} {% for item in certbot_create_standalone_stop_services %} echo "stopping service {{ item }}" -{% if ansible_service_mgr == 'systemd' %} -systemctl stop {{ item }} -{% elif ansible_service_mgr == 'upstart' %} +{% if ansible_service_mgr == 'upstart' %} initctl stop {{ item }} {% elif ansible_service_mgr == 'openrc' %} rc-service {{ item }} stop @@ -13,3 +14,4 @@ rc-service {{ item }} stop service {{ item }} stop {% endif %} {% endfor %} +{% endif %}