diff options
Diffstat (limited to 'roles/certificate/tasks/main.yml')
-rw-r--r-- | roles/certificate/tasks/main.yml | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/roles/certificate/tasks/main.yml b/roles/certificate/tasks/main.yml new file mode 100644 index 0000000..0edc725 --- /dev/null +++ b/roles/certificate/tasks/main.yml @@ -0,0 +1,18 @@ +- ansible.builtin.include_role: + name: certbot + +- name: Request SSL certificate from Let's Encrypt + shell: | + # Make task independent: if nginx is already running, stop it and then + # start back on exit. + [ -f /var/run/nginx.pid ] && systemctl stop nginx + trap "systemctl start nginx" EXIT + certbot certonly \ + --standalone \ + --agree-tos \ + --renew-by-default \ + --email webmaster@ilvokhin.com \ + --rsa-key-size 4096 \ + -d {{ domains | join(' -d ') }} + args: + creates: '/etc/letsencrypt/live/{{ domains | first }}/fullchain.pem' |