Commit e3359162 by Martin Fitzpatrick Committed by Fred Smith

Restart nginx service after setup; check email is provided

Fixes to restart nginx service after setup (was previously
performed on a post-hook which would only run on an update)
and to check that an email is provided (in the playbook).
parent a2fabfa1
...@@ -57,6 +57,14 @@ ...@@ -57,6 +57,14 @@
- install - install
- update - update
- name: check email
fail:
msg: "Email address was not provided"
when: LETS_ENCRYPT_EMAIL == None
tags:
- install
- update
- name: install certbot - name: install certbot
git: git:
repo: https://github.com/certbot/certbot repo: https://github.com/certbot/certbot
......
...@@ -13,7 +13,11 @@ service nginx start || true ...@@ -13,7 +13,11 @@ service nginx start || true
echo "Request certificate via certbot... (or renew)" echo "Request certificate via certbot... (or renew)"
# Run certbot installation # Run certbot installation
/opt/certbot/certbot-auto certonly --webroot --webroot-path=/usr/share/nginx/www --email {{ LETS_ENCRYPT_EMAIL }} --agree-tos --http-01-port {{ LETS_ENCRYPT_PORT }} {% for domain in LETS_ENCRYPT_DOMAINS %} -d {{ domain }} {% endfor %} --non-interactive --post-hook "service nginx restart" /opt/certbot/certbot-auto certonly --webroot --webroot-path=/usr/share/nginx/www --email {{ LETS_ENCRYPT_EMAIL }} --agree-tos --http-01-port {{ LETS_ENCRYPT_PORT }} {% for domain in LETS_ENCRYPT_DOMAINS %} -d {{ domain }} {% endfor %} --non-interactive
echo "Restarting nginx service to reload config..."
service nginx restart
echo "Create symlinks to Let's Encrypt certificates..." echo "Create symlinks to Let's Encrypt certificates..."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment