blob: 8e441ffde19f390f09331e723156c8fa8b0471b4 (
plain)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
- name: Add mox group
ansible.builtin.group:
name: mox
- name: Add mox user
ansible.builtin.user:
name: mox
group: mox
groups:
- tls
append: false
- name: Assign mox as owner of ~mox home directory
register: mox_home_dir
ansible.builtin.file:
path: ~mox
owner: mox
group: mox
mode: "750"
- name: Create mox configuration directory
register: mox_conf_dir
ansible.builtin.file:
path: ~mox/config/
owner: mox
group: mox
mode: "770"
- name: Create DKIM private keys directory
register: mox_dkim_dir
ansible.builtin.file:
path: ~mox/config/dkim
owner: mox
group: mox
mode: "770"
- name: Install DKIM private key A
register: mox_dkim_a
ansible.builtin.copy:
src: dkim/2026a._domainkey.mail.joeac.net.20260705T163220.rsa2048.privatekey.pkcs8.pem
dest: ~mox/config/dkim/2026a._domainkey.mail.joeac.net.20260705T163220.rsa2048.privatekey.pkcs8.pem
owner: mox
group: mox
mode: "660"
- name: Install DKIM private key B
register: mox_dkim_b
ansible.builtin.copy:
src: dkim/2026b._domainkey.mail.joeac.net.20260705T163220.rsa2048.privatekey.pkcs8.pem
dest: ~mox/config/dkim/2026b._domainkey.mail.joeac.net.20260705T163220.rsa2048.privatekey.pkcs8.pem
owner: mox
group: mox
mode: "660"
- name: Install adminpasswd
register: mox_adminpasswd
ansible.builtin.copy:
src: adminpasswd
dest: ~mox/config/adminpasswd
owner: mox
group: mox
mode: "660"
- name: Install mox configuration
register: mox_conf
ansible.builtin.template:
src: mox.conf
dest: ~mox/config/mox.conf
owner: mox
group: mox
mode: "660"
- name: Install mox domain configuration
register: mox_domain_conf
ansible.builtin.template:
src: domains.conf
dest: ~mox/config/domains.conf
owner: mox
group: mox
mode: "660"
- name: Create mox data directory
ansible.builtin.file:
path: ~mox/data
state: directory
owner: mox
group: mox
mode: "770"
- name: Create unbound configuration directory
ansible.builtin.file:
path: /etc/unbound/unbound.conf.d
state: directory
mode: "444"
- name: Install DNSSEC configuration
register: dnssec_conf
ansible.builtin.template:
src: dnssec.conf
dest: /etc/unbound/unbound.conf.d/dnssec.conf
- name: Install unbound binary
community.general.apk:
name: unbound
state: present
- name: Restart unbound service and configure to start on boot
when: dnssec_conf is changed
ansible.builtin.service:
name: unbound
enabled: true
state: restarted
- name: Start unbound service and configure to start on boot
when: not ( dnssec_conf is changed )
ansible.builtin.service:
name: unbound
enabled: true
state: started
- name: Configure networking to point at unbound DNS resolver
ansible.builtin.copy:
content: "nameserver: 127.0.0.1"
dest: /etc/resolv.conf
backup: true
mode: "444"
- name: Install mox binary
register: mox_binary
ansible.builtin.get_url:
dest: /usr/bin/mox
mode: "755"
url: "{{ mox_url }}"
- name: Install mox service
register: mox_service
ansible.builtin.copy:
src: openrc/mox
dest: /etc/init.d/mox
mode: "755"
- name: Restart mox service and configure to start on boot
when:
mox_home_dir is changed
or mox_conf_dir is changed
or mox_dkim_dir is change
or mox_dkim_a is change
or mox_dkim_b is change
or mox_adminpasswd is change
or mox_conf is change
or mox_domain_conf is changed
or mox_binary is changed
or mox_service is changed
ansible.builtin.service:
name: mox
enabled: true
state: started
- name: Start mox service and configure to start on boot
when: not (
mox_home_dir is changed
or mox_conf_dir is changed
or mox_dkim_dir is change
or mox_dkim_a is change
or mox_dkim_b is change
or mox_adminpasswd is change
or mox_conf is change
or mox_domain_conf is changed
or mox_binary is changed
or mox_service is changed )
ansible.builtin.service:
name: mox
enabled: true
state: started
|