Check for systemd list-unit-files before restarting services

Co-authored-by: Karl M. Davis <karl@justdavis.com>
pull/97/head
simonspa 3 years ago committed by Simon Spannagel
parent 7a7c1f8b06
commit 52a96f9bde
  1. 7
      defaults/main.yml

@ -60,4 +60,9 @@ certbot_keep_updated: true
certbot_dir: /opt/certbot certbot_dir: /opt/certbot
# Restart this service after successfull certificate creation: # Restart this service after successfull certificate creation:
certbot_deployhook: "service {{ certbot_create_standalone_stop_services | join(' restart && service ') }} restart" certbot_deployhook: |
{% for service in certbot_create_standalone_stop_services %}
if systemctl list-unit-files | grep -q "^{{ service }}.service"; then
systemctl restart {{ service }}
fi
{% endfor %}

Loading…
Cancel
Save