]> git.somenet.org - root/pub/somesible.git/blob - roles/service/sympa/tasks/main.yml
[roles/service/sympa] Mailinglist service - TODO: this does not work yet.
[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 list_aliases.tt2
90   copy:
91     src: "{{item}}"
92     dest: "/etc/sympa/list_aliases.tt2"
93     mode: 0644
94     owner: "sympa"
95     group: "sympa"
96   with_first_found:
97     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/list_aliases.tt2"
98     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/list_aliases.tt2"
99     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/list_aliases.tt2"
100     - "default/list_aliases.tt2"
101   notify: restart sympa.service
102   when: result.changed
103
104
105 - name: include vars_nginx_vhost_custom
106   include_vars:
107     file: "{{item}}"
108     name: vars_nginx_vhost_custom
109   with_first_found:
110     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/{{sympa_main_host_name}}-vars_nginx_vhost_custom.yml"
111     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/{{sympa_main_host_name}}-vars_nginx_vhost_custom.yml"
112     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/{{sympa_main_host_name}}-vars_nginx_vhost_custom.yml"
113     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/vars_nginx_vhost_custom.yml"
114     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/vars_nginx_vhost_custom.yml"
115     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/vars_nginx_vhost_custom.yml"
116     - "default/vars_nginx_vhost_custom.yml"
117
118
119 - name: configure vhost for "{{sympa_main_host_name}}"
120   include_role:
121     name: server/nginx/vhost-unified
122   vars:
123     vhost_type: "custom"
124     vhost_name: "{{sympa_main_host_name}}"
125     vhost_custom:
126       vhost_custom_pre_server: "{{vars_nginx_vhost_custom.vhost_custom_pre_server}}"
127       vhost_custom: "{{vars_nginx_vhost_custom.vhost_custom}}"
128
129
130 - name: enable and start sympa.service
131   include_role: name="base/systemd/enable-and-start"
132   vars:
133     service_name: sympa.service
134
135 - name: enable and start wwsympa.socket
136   include_role: name="base/systemd/enable-and-start"
137   vars:
138     service_name: wwsympa.socket