blob: 3473d5416a56ebe21f6a5329f9e15ff87224de2a (
plain) (
blame)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
---
- name: install needed packages
apt:
name:
- uacme
- "{{ python_basename }}-openssl"
state: present
- name: create acme account key
command: "uacme -c /var/lib/uacme.d -a '{{ uacme_directory_server }}' -y{% if uacme_eab is defined %} -e {{ uacme_eab }}{% endif %} new '{{ uacme_account_email }}'"
args:
creates: /var/lib/uacme.d/private/key.pem
- name: create standard uacme webroot path
when: uacme_challenge_webroot_path is not defined
block:
- name: install systemd tmpfiles config
copy:
dest: /usr/lib/tmpfiles.d/uacme.conf
content: |
d /var/run/acme/acme-challenge 0755 root root - -
register: uacme_systemd_tmpfiles_config
- name: trigger systemd-tmpfiles
when: uacme_systemd_tmpfiles_config is changed
command: systemd-tmpfiles --create
- name: create non-standard uacme webroot path
when: uacme_challenge_webroot_path is defined
file:
name: "{{ uacme_challenge_webroot_path }}"
state: directory
- name: make sure nginx snipped directory exists
file:
path: /etc/nginx/snippets
state: directory
- name: generate nginx snippet for webroot challenges
copy:
dest: /etc/nginx/snippets/uacme.conf
content: |
location /.well-known/acme-challenge/ {
alias {{ uacme_challenge_webroot_path | default('/var/run/acme/acme-challenge') }}/;
}
- name: install reconcile script
template:
src: uacme-reconcile.sh.j2
dest: /usr/local/bin/uacme-reconcile.sh
mode: 0755
- name: install systemd unit for automatic refresh
loop:
- service
- timer
template:
src: "uacme-reconcile.{{ item }}.j2"
dest: "/etc/systemd/system/uacme-reconcile.{{ item }}"
- name: create system unit snippet directory
file:
path: /etc/systemd/system/uacme-reconcile.service.d/
state: directory
- name: make sure systemd timer for automatic refresh is enabled and started
systemd:
daemon_reload: yes
name: uacme-reconcile.timer
state: started
enabled: yes
|