add cron to renew taiga cert

This commit is contained in:
doteast 2016-11-02 18:10:34 +00:00
parent d586e8e6c5
commit 3189b02479
4 changed files with 29 additions and 0 deletions

View file

@ -0,0 +1 @@
* * * * 0 root /usr/local/bin/renew-cert.sh

View 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

View file

@ -13,3 +13,7 @@
- name: restart postfix
service: name=postfix state=restarted
- name: restart crond
service: name=crond state=restarted

View file

@ -185,6 +185,17 @@
state=link
tags: taiga
### 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
- template: src=taiga-http.nginx dest=/etc/nginx/conf.d/taiga-http.conf