Add nginx service conditional to LetsEncrypt role.

Resolve issue #1
This commit is contained in:
staticsafe 2017-01-14 03:51:43 +00:00
parent 6b87ad2c87
commit 0d09eae129
1 changed files with 9 additions and 0 deletions

View File

@ -2,6 +2,11 @@
- name: Install LetsEncrypt client
apt: name=letsencrypt state=latest
- name: stop nginx if it already is up and running
service: name=nginx state=stopped
register: result
ignore_errors: True
- name: Generate LetsEncrypt TLS certificates
shell: letsencrypt certonly -n -m "letsencrypt@sadiqsaif.ca" --agree-tos --standalone -d {{ item }}
with_items:
@ -13,6 +18,10 @@
- twoshadesofbrown.com
- wiki.staticsafe.ca
- name: start nginx if we stopped it before
service: name=nginx state=started
when: result|succeeded
- name: Add a cron job to automatically renew LetsEncrypt certificates
copy: src=letsencrypt-renew dest=/etc/cron.daily/letsencrypt-renew mode=0700
notify: