Adds the absolute certbot script path in the systemd service

This commit is contained in:
Nikolaos Kakouros 2017-09-07 00:45:47 +02:00
parent 6105075d4e
commit 4e2429a8f4
2 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,11 @@
---
- name: Resolve absolute path for certbot script
command: "which {{ certbot_script }}"
register: certbot_script_absolute
when: not certbot_install_from_source
changed_when: false
- name: Create certbot-renew service
template:
src: certbot-renew.service.j2

View File

@ -4,6 +4,10 @@ Description=Let's Encrypt renewal service
[Service]
User={{ certbot_auto_renew_user }}
Type=oneshot
ExecStart={{ certbot_script }} renew --quiet --agree-tos
{% if certbot_script_absolute is defined %}
ExecStart={{ certbot_script_absolute.stdout }} renew --quiet --agree-tos
{% else %}
ExecStart={{ certbot_script }} renew --quiet --agree-tos
{% endif %}
ExecStartPost=/bin/systemctl reload {{ certbot_web_service }}.service