1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
---
- hosts: all
  tasks:

  - apt:
      update_cache: yes

  - package:
      name:
      - certbot

  - service:
      name: nginx
      state: stopped

  - command: >
      certbot certonly --standalone --preferred-challenges http
      -n --agree-tos -m {{ lets_encrypt_email }}
      -d {{ item }}
    loop: "{{ lets_encrypt_tlds }}"

  - service:
      name: nginx
      state: started

  - template:
      src: renew-certs
      dest: /etc/cron.daily/renew-certs
      mode: +x