Skip to content

Commit

Permalink
Merge pull request #15 from minrk/letsencrypt-repetitive
Browse files Browse the repository at this point in the history
only run letsencrypt if needed
  • Loading branch information
minrk committed Jun 7, 2016
2 parents 05e2f0a + 41dfd1d commit afed982
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions roles/nginx/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,21 @@
become: true
when: use_letsencrypt

- stat: path=/etc/letsencrypt/live/{{inventory_hostname}}/cert.pem
register: letsencrypt_cert

- name: clone or update the latest letsencrypt repo
git: repo=https://github.com/letsencrypt/letsencrypt.git dest=/tmp/letsencrypt
git: repo=https://github.com/letsencrypt/letsencrypt.git dest=/tmp/letsencrypt force=yes
become: true
when: use_letsencrypt
when: use_letsencrypt and letsencrypt_cert.stat.exists == False

- name: run letsencrypt to generate SSL certs
command: ./letsencrypt-auto certonly --standalone --agree-tos -m {{letsencrypt_email}} -d {{inventory_hostname}}
args:
chdir: /tmp/letsencrypt
creates: /etc/letsencrypt/live/{{inventory_hostname}}/
become: true
when: use_letsencrypt
when: use_letsencrypt and letsencrypt_cert.stat.exists == False

# ---------------------------------------------------
# Or, install existing SSL cert/key
Expand Down

0 comments on commit afed982

Please sign in to comment.