]> git.somenet.org - root/pub/somesible.git/blob - roles/server/mail/cyrus/tasks/main.yml
roles/base/backup/files
[root/pub/somesible.git] / roles / server / mail / cyrus / tasks / main.yml
1 #####################################
2 ### someone's ansible provisioner ###
3 #####################################
4 # Part of: https://git.somenet.org/root/pub/somesible.git
5 # 2017-2024 by someone <someone@somenet.org>
6 #
7 ---
8 - name: install cyrus
9   apt:
10     pkg:
11     - cyrus-admin
12     - cyrus-clients
13     - cyrus-imapd
14     state: present
15     policy_rc_d: 101
16   tags: "online"
17   ignore_errors: "{{ignore_online_errors | bool}}"
18
19
20 - name: add cyrus user to group ssl-cert,letsencrypt
21   user:
22     name: "cyrus"
23     groups: "ssl-cert,letsencrypt"
24     append: yes
25     createhome: no
26     state: present
27
28
29 - name: copy cyrus.conf
30   copy:
31     src: "{{item}}"
32     dest: "/etc/cyrus.conf"
33     mode: 0644
34     owner: "root"
35     group: "root"
36   with_first_found:
37     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/cyrus.conf"
38     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/cyrus.conf"
39     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/cyrus.conf"
40     - "default/cyrus.conf"
41   notify: restart cyrus-imapd.service
42
43
44 - name: copy imapd.conf
45   copy:
46     src: "{{item}}"
47     dest: "/etc/imapd.conf"
48     mode: 0644
49     owner: "root"
50     group: "root"
51   with_first_found:
52     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/imapd.conf"
53     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/imapd.conf"
54     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/imapd.conf"
55     - "default/imapd.conf"
56   notify: restart cyrus-imapd.service
57
58
59 - name: copy default.sieve
60   copy:
61     src: "{{item}}"
62     dest: "/var/lib/cyrus/default.sieve"
63     mode: 0600
64     owner: "cyrus"
65     group: "mail"
66   with_first_found:
67     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/default.sieve"
68     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/default.sieve"
69     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/default.sieve"
70     - "default/default.sieve"
71   notify: restart cyrus-imapd.service
72
73
74 - name: enable and start cyrus-imapd.service
75   include_role: name="base/systemd/enable-and-start"
76   vars:
77     service_name: cyrus-imapd.service