]> git.somenet.org - root/pub/somesible.git/blob - roles/service/sympa/tasks/main.yml
[roles/util] ----- meta ----- No dependencies
[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-2024 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 /etc/sympa
12   file:
13     path: "/etc/sympa"
14     state: directory
15     mode: 0755
16     owner: "sympa"
17     group: "sympa"
18
19 - name: create /etc/sympa/sympa
20   file:
21     path: "/etc/sympa/sympa"
22     state: directory
23     mode: 0755
24     owner: "sympa"
25     group: "sympa"
26
27
28 - name: copy sympa.debconf
29   copy:
30     src: "{{item}}"
31     dest: "/etc/sympa/sympa/sympa.debconf"
32     mode: 0644
33     owner: "sympa"
34     group: "sympa"
35   with_first_found:
36     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/sympa.debconf"
37     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/sympa.debconf"
38     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/sympa.debconf"
39     - "default/sympa.debconf"
40   notify: restart sympa.service
41
42
43 - name: preseed sympa.debconf
44   shell: 'debconf-set-selections /etc/sympa/sympa/sympa.debconf'
45
46
47 - name: copy sympa config
48   copy:
49     src: "{{item}}"
50     dest: "/etc/sympa/sympa/sympa.conf"
51     mode: 0644
52     owner: "sympa"
53     group: "sympa"
54   with_first_found:
55     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/sympa.conf"
56     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/sympa.conf"
57     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/sympa.conf"
58     - "default/sympa.conf"
59   notify: restart sympa.service
60
61
62 - name: install sympa
63   apt:
64     pkg:
65     - sympa
66     state: present
67     policy_rc_d: 101
68   tags: "online"
69   ignore_errors: "{{ignore_online_errors | bool}}"
70   register: result
71
72
73 - name: copy sympa config again
74   copy:
75     src: "{{item}}"
76     dest: "/etc/sympa/sympa/sympa.conf"
77     mode: 0644
78     owner: "sympa"
79     group: "sympa"
80   with_first_found:
81     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/sympa.conf"
82     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/sympa.conf"
83     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/sympa.conf"
84     - "default/sympa.conf"
85   notify: restart sympa.service
86   when: result.changed
87
88
89 - name: copy key_dkim.private
90   copy:
91     src: "{{item}}"
92     dest: "/etc/sympa/sympa/key_dkim.private"
93     mode: 0640
94     owner: "sympa"
95     group: "sympa"
96   with_first_found:
97     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/key_dkim.private"
98     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/key_dkim.private"
99     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/key_dkim.private"
100     - "default/key_dkim.private"
101   notify: restart sympa.service
102
103
104 - name: copy list_aliases.tt2
105   copy:
106     src: "{{item}}"
107     dest: "/etc/sympa/list_aliases.tt2"
108     mode: 0644
109     owner: "sympa"
110     group: "sympa"
111   with_first_found:
112     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/list_aliases.tt2"
113     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/list_aliases.tt2"
114     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/list_aliases.tt2"
115     - "default/list_aliases.tt2"
116   notify: restart sympa.service
117
118
119 - name: include vars_nginx_vhost_custom
120   include_vars:
121     file: "{{item}}"
122     name: vars_nginx_vhost_custom
123   with_first_found:
124     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/{{sympa_main_host_name}}-vars_nginx_vhost_custom.yml"
125     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/{{sympa_main_host_name}}-vars_nginx_vhost_custom.yml"
126     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/{{sympa_main_host_name}}-vars_nginx_vhost_custom.yml"
127     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/vars_nginx_vhost_custom.yml"
128     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/vars_nginx_vhost_custom.yml"
129     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/vars_nginx_vhost_custom.yml"
130     - "default/vars_nginx_vhost_custom.yml"
131
132
133 - name: configure vhost for "{{sympa_main_host_name}}"
134   include_role:
135     name: server/nginx/vhost-unified
136   vars:
137     vhost_type: "custom"
138     vhost_name: "{{sympa_main_host_name}}"
139     vhost_custom:
140       vhost_custom_pre_server: "{{vars_nginx_vhost_custom.vhost_custom_pre_server}}"
141       vhost_custom: "{{vars_nginx_vhost_custom.vhost_custom}}"
142
143
144 - name: enable and start sympa.service
145   include_role: name="base/systemd/enable-and-start"
146   vars:
147     service_name: sympa.service
148
149 - name: enable and start wwsympa.socket
150   include_role: name="base/systemd/enable-and-start"
151   vars:
152     service_name: wwsympa.socket