summaryrefslogtreecommitdiff
path: root/roles/certificate/tasks/main.yml
blob: 225ada2f48d192f2be7edb46176385bd61275f73 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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'