mirror of
https://github.com/geerlingguy/ansible-role-certbot.git
synced 2025-04-19 17:01:37 +02:00
Switches from cron to systemd
This commit is contained in:
parent
f00a0ba181
commit
3e46e4ba8f
8
handlers/main.yml
Normal file
8
handlers/main.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Restart certbot-renew service
|
||||||
|
service:
|
||||||
|
name: certbot-renew
|
||||||
|
state: restarted
|
||||||
|
enabled: true
|
||||||
|
listen: restart-certbot-renew-service
|
@ -7,5 +7,5 @@
|
|||||||
- include: install-from-source.yml
|
- include: install-from-source.yml
|
||||||
when: certbot_install_from_source
|
when: certbot_install_from_source
|
||||||
|
|
||||||
- include: renew-cron.yml
|
- include: systemd.yml
|
||||||
when: certbot_auto_renew
|
when: certbot_auto_renew
|
||||||
|
13
tasks/systemd.yml
Normal file
13
tasks/systemd.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Create certbot-renew service
|
||||||
|
template:
|
||||||
|
src: certbot-renew.service.j2
|
||||||
|
dest: /etc/systemd/system/certbot-renew.service
|
||||||
|
notify: restart-certbot-renew-service
|
||||||
|
|
||||||
|
- name: Create certbot-renew timer
|
||||||
|
template:
|
||||||
|
src: certbot-renew.timer
|
||||||
|
dest: /etc/systemd/system/certbot-renew.timer
|
||||||
|
notify: restart-certbot-renew-service
|
9
templates/certbot-renew.service.j2
Normal file
9
templates/certbot-renew.service.j2
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Let's Encrypt renewal
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User={{ certbot_auto_renew_user }}
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart={{ certbot_script }} renew --quiet --agree-tos
|
||||||
|
|
||||||
|
ExecStartPost=/bin/systemctl reload {{ certbot_web_service }}.service
|
9
templates/certbot-renew.timer.j2
Normal file
9
templates/certbot-renew.timer.j2
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Periodically check for Let's Encrypt's certificates renewal
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=*-*-* {{ certbot_auto_renew_hour }}:{{ certbot_auto_renew_minute }}:00
|
||||||
|
Persistent=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
@ -1 +1,2 @@
|
|||||||
certbot_package: letsencrypt
|
certbot_package: letsencrypt
|
||||||
|
certbot_web_service: apache2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user