-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
cert.yml
54 lines (48 loc) · 1.31 KB
/
cert.yml
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
- name: Get TLS bundle
hosts: management
tasks:
- name: Renew certificate
become: true
shell: |
certbot \
renew \
--webroot \
--webroot-path /usr/share/caddy/ \
--preferred-challenges http-01 \
--email {{ email }} \
--agree-tos \
--no-eff-email \
--manual-public-ip-logging-ok
- name: Get TLS certificate
become: true
shell: cat /etc/letsencrypt/live/dns.emeraldonion.org/fullchain.pem
register: tls_cert
- name: Get TLS key
become: true
shell: cat /etc/letsencrypt/live/dns.emeraldonion.org/privkey.pem
register: tls_key
- name: Deploy bundle
hosts: dns_servers
tasks:
- name: Copy TLS certificate
become: true
copy:
content: "{{ hostvars['management-sea']['tls_cert']['stdout'] }}"
dest: /opt/dns/cert.pem
- name: Copy TLS key
become: true
copy:
content: "{{ hostvars['management-sea']['tls_key']['stdout'] }}"
dest: /opt/dns/key.pem
- name: Reload nginx
become: true
systemd:
name: nginx
state: reloaded
- name: Restart services that can't be live reloaded
become: true
systemd:
name: "{{ item }}"
state: restarted
loop:
- kresd@1