/
main.yml
57 lines (46 loc) · 1.36 KB
/
main.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
55
56
57
---
- name: Install required packages
openbsd_pkg:
name: "{{ item }}"
state: present
with_items: ['dovecot', 'dkimproxy', 'certbot', 'procmail', 'spampd', 'clamsmtp']
- name: ClamAV Tasks
include_tasks: clamav.yml
- name: Dovecot Tasks
include_tasks: dovecot.yml
- name: Lets Encrypt Tasks
include_tasks: letsencrypt.yml
- name: Spam Prevention Tasks
include_tasks: spam.yml
- name: DKIM Tasks
include_tasks: dkim.yml
- name: OpenSMTPD Tasks
include_tasks: opensmtpd.yml
- name: Added e-mail users to system
user:
name: "{{ item }}"
shell: /usr/local/bin/fish
with_items: "{{ users.keys() | list }}"
- name: Setup Procmail for users
template:
src: user.procmailrc.j2
dest: "/home/{{ item }}/.procmailrc"
owner: "{{ item }}"
group: "{{ item }}"
mode: 0644
force: no
with_items: "{{ users.keys() | list }}"
- name: Add users Maildir
file:
path: /home/{{ item }}/Mail
state: directory
owner: "{{ item }}"
group: "{{ item }}"
mode: 0700
with_items: "{{ users.keys() | list }}"
- name: Enable Services
command: "rcctl enable {{ item }}"
with_items: ['freshclam', 'clamd', 'cron', 'clamsmtpd', 'dkimproxy_out', 'smtpd', 'dovecot']
- name: Start Services
command: "/etc/rc.d/{{ item }} start"
with_items: ['freshclam', 'clamd', 'cron', 'clamsmtpd', 'dkimproxy_out', 'spampd', 'smtpd', 'dovecot']