]> git.somenet.org - root/pub/somesible.git/blob - roles/service/sympa/tasks/main.yml
roles/service/nextcloud/defaults
[root/pub/somesible.git] / roles / service / sympa / tasks / main.yml
1 #####################################
2 ### someone's ansible provisioner ###
3 #####################################
4 # Part of: https://git.somenet.org/root/pub/somesible.git
5 # 2017-2026 by someone <someone@somenet.org>
6 #
7 # Sympa is broken in debian, in that it cannot be installed with dbconfig-no-thanks.
8 # To work around this, we have to first debconf-preseed some config values and deploy the config file before AND after installing the sympa package.
9 # todo: move to sertvices?
10 ---
11 - name: create sympa user
12   user:
13     name: "sympa"
14     home: "/var/lib/sympa"
15     system: yes
16     state: present
17
18
19 - name: create /etc/sympa
20   file:
21     path: "/etc/sympa"
22     state: directory
23     mode: 0755
24     owner: "sympa"
25     group: "sympa"
26
27 - name: create /etc/sympa/sympa
28   file:
29     path: "/etc/sympa/sympa"
30     state: directory
31     mode: 0755
32     owner: "sympa"
33     group: "sympa"
34
35
36 - name: copy sympa.debconf
37   copy:
38     src: "{{item}}"
39     dest: "/etc/sympa/sympa/sympa.debconf"
40     mode: 0644
41     owner: "sympa"
42     group: "sympa"
43   with_first_found:
44     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/sympa.debconf"
45     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/sympa.debconf"
46     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/sympa.debconf"
47     - "default/sympa.debconf"
48   notify: restart sympa.service
49
50
51 - name: preseed sympa.debconf
52   shell: 'debconf-set-selections /etc/sympa/sympa/sympa.debconf'
53
54
55 - name: copy sympa config
56   copy:
57     src: "{{item}}"
58     dest: "/etc/sympa/sympa/sympa.conf"
59     mode: 0644
60     owner: "sympa"
61     group: "sympa"
62   with_first_found:
63     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/sympa.conf"
64     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/sympa.conf"
65     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/sympa.conf"
66     - "default/sympa.conf"
67   notify: restart sympa.service
68
69
70 - name: install sympa
71   apt:
72     pkg:
73     - sympa
74     state: present
75     policy_rc_d: 101
76   tags: "online"
77   ignore_errors: "{{ignore_online_errors | bool}}"
78   register: result
79
80
81 - name: copy sympa config again
82   copy:
83     src: "{{item}}"
84     dest: "/etc/sympa/sympa/sympa.conf"
85     mode: 0644
86     owner: "sympa"
87     group: "sympa"
88   with_first_found:
89     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/sympa.conf"
90     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/sympa.conf"
91     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/sympa.conf"
92     - "default/sympa.conf"
93   notify: restart sympa.service
94   when: result is defined and result.changed
95
96
97 - name: copy key_dkim.private
98   copy:
99     src: "{{item}}"
100     dest: "/etc/sympa/sympa/key_dkim.private"
101     mode: 0640
102     owner: "sympa"
103     group: "sympa"
104   with_first_found:
105     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/key_dkim.private"
106     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/key_dkim.private"
107     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/key_dkim.private"
108     - "default/key_dkim.private"
109   notify: restart sympa.service
110
111
112 - name: copy list_aliases.tt2
113   copy:
114     src: "{{item}}"
115     dest: "/etc/sympa/list_aliases.tt2"
116     mode: 0644
117     owner: "sympa"
118     group: "sympa"
119   with_first_found:
120     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/list_aliases.tt2"
121     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/list_aliases.tt2"
122     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/list_aliases.tt2"
123     - "default/list_aliases.tt2"
124   notify: restart sympa.service
125
126
127 - name: include vars_nginx_vhost_custom
128   include_vars:
129     file: "{{item}}"
130     name: vars_nginx_vhost_custom
131   with_first_found:
132     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/{{sympa_main_host_name}}-vars_nginx_vhost_custom.yml"
133     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/{{sympa_main_host_name}}-vars_nginx_vhost_custom.yml"
134     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/{{sympa_main_host_name}}-vars_nginx_vhost_custom.yml"
135     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/vars_nginx_vhost_custom.yml"
136     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/vars_nginx_vhost_custom.yml"
137     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/vars_nginx_vhost_custom.yml"
138     - "default/vars_nginx_vhost_custom.yml"
139
140
141 - name: configure vhost for "{{sympa_main_host_name}}"
142   include_role:
143     name: server/nginx/vhost-unified
144   vars:
145     vhost_type: "custom"
146     vhost_name: "{{sympa_main_host_name}}"
147     vhost_custom:
148       vhost_custom_pre_server: "{{vars_nginx_vhost_custom.vhost_custom_pre_server}}"
149       vhost_custom: "{{vars_nginx_vhost_custom.vhost_custom}}"
150
151
152 - name: enable and start sympa.service
153   include_role: name="base/systemd/enable-and-start"
154   vars:
155     service_name: sympa.service
156
157 - name: enable and start wwsympa.socket
158   include_role: name="base/systemd/enable-and-start"
159   vars:
160     service_name: wwsympa.socket