add cron to renew taiga cert
This commit is contained in:
parent
d586e8e6c5
commit
3189b02479
4 changed files with 29 additions and 0 deletions
1
roles/taiga/files/cron-renew-cert
Normal file
1
roles/taiga/files/cron-renew-cert
Normal file
|
@ -0,0 +1 @@
|
||||||
|
* * * * 0 root /usr/local/bin/renew-cert.sh
|
13
roles/taiga/files/renew-cert.sh
Normal file
13
roles/taiga/files/renew-cert.sh
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# backup and renew letsencrypt certificate. it checks if cert need renewal. if not nginx will not stop
|
||||||
|
|
||||||
|
BACKUPDIR=/backups
|
||||||
|
# create backup
|
||||||
|
/usr/bin/tar Pczf /$BACKUPDIR/letsencrypt-$(date +%F).tgz /etc/letsencrypt
|
||||||
|
|
||||||
|
# check and renew if required. if so do it in standalone mode
|
||||||
|
/usr/bin/certbot renew -q --pre-hook "/usr/bin/systemctl stop nginx" --post-hook "/usr/bin/systemctl start nginx"
|
||||||
|
|
||||||
|
# delete the backup three weeks ago.
|
||||||
|
rm -f /$BACKUPDIR/letsencrypt-$(date --date="3 weeks ago" +%F).tgz
|
||||||
|
|
|
@ -13,3 +13,7 @@
|
||||||
|
|
||||||
- name: restart postfix
|
- name: restart postfix
|
||||||
service: name=postfix state=restarted
|
service: name=postfix state=restarted
|
||||||
|
|
||||||
|
- name: restart crond
|
||||||
|
service: name=crond state=restarted
|
||||||
|
|
||||||
|
|
|
@ -185,6 +185,17 @@
|
||||||
state=link
|
state=link
|
||||||
tags: taiga
|
tags: taiga
|
||||||
### DONE with taiga-front
|
### DONE with taiga-front
|
||||||
|
### cron to renew and backup certificates
|
||||||
|
- file: src=renew-cert.sh dest=/usr/local/bin/renew-cert.sh mode=0755
|
||||||
|
tags:
|
||||||
|
- taiga
|
||||||
|
- cron
|
||||||
|
|
||||||
|
- file: src=cron-renew-cert dest=/etc/cron.d/cron-renew-cert
|
||||||
|
notify: restart crond
|
||||||
|
tags:
|
||||||
|
- taiga
|
||||||
|
- cron
|
||||||
|
|
||||||
### FINALLY, nginx to serve/proxy it all
|
### FINALLY, nginx to serve/proxy it all
|
||||||
- template: src=taiga-http.nginx dest=/etc/nginx/conf.d/taiga-http.conf
|
- template: src=taiga-http.nginx dest=/etc/nginx/conf.d/taiga-http.conf
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue