forked from stuvusIT/sympa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.yml
174 lines (155 loc) · 3.75 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
- name: Set database to mysql
debconf:
name: sympa
question: sympa/database-type
value: mysql
vtype: select
- name: Set webserver to other
debconf:
name: sympa
question: wwsympa/webserver_type
value: Other
vtype: select
- name: "Set dbconfig-install to no"
debconf:
name: sympa
question: sympa/dbconfig-install
value: no
vtype: boolean
changed_when: false
- name: Create a new database with name '{{ sympa_db_name }}'
mysql_db:
name: "{{ sympa_db_name }}"
encoding: utf8
- name: Create DB user '{{ sympa_db_user }}'
mysql_user:
name: "{{ sympa_db_user }}"
password: "{{ sympa_db_password | mandatory }}"
priv: '{{ sympa_db_name }}.*:ALL,GRANT'
no_log: True
- name: Create sympa dir
file:
path: "/etc/sympa/sympa"
state: directory
- name: Create sympa.conf
template:
src: sympa.conf.j2
dest: /etc/sympa/sympa/sympa.conf
mode: 0600
notify:
- Reload sympa config
- Restart sympa
- name: Install packages
apt:
name:
- sympa
- fcgiwrap
- name: Fix permissions
file:
path: "/etc/sympa/{{ item }}"
owner: sympa
group: sympa
loop:
- ""
- "sympa/"
- "sympa/sympa.conf"
- name: Create ldap_alias_manager.conf
template:
src: ldap_alias_manager.conf.j2
dest: /etc/sympa/ldap_alias_manager.conf
owner: sympa
group: sympa
mode: 0600
when: sympa_ldap_alias_manager_conf is defined
- name: Create ldap_alias_entry.tt2
copy:
content: "{{ sympa_ldap_alias_entry }}"
dest: /etc/sympa/ldap_alias_entry.tt2
owner: sympa
group: sympa
mode: 0600
when: sympa_ldap_alias_entry is defined
- name: Create folders for list templates
file:
path: "/etc/sympa/create_list_templates/{{ item.name }}"
state: directory
mode: 0750
owner: sympa
group: sympa
loop: "{{ sympa_template_lists }}"
- name: Create comment.tt2 for list templates
copy:
content: "{{ item.config }}"
dest: "/etc/sympa/create_list_templates/{{ item.name }}/config.tt2"
owner: sympa
group: sympa
mode: 0600
loop: "{{ sympa_template_lists }}"
- name: Create comment.tt2 for list templates
copy:
content: "{{ item.comment }}"
dest: "/etc/sympa/create_list_templates/{{ item.name }}/comment.tt2"
owner: sympa
group: sympa
mode: 0600
loop: "{{ sympa_template_lists }}"
- name: Disable default templates
lineinfile:
path: /usr/share/sympa/default/create_list.conf
line: "{{ item }} hidden"
when: not sympa_show_default_templates
loop:
- hotline
- news-letter
- confidential
- discussion_list
- html-news-letter
- intranet_list
- private_working_group
- public_web_forum
- name: Enable default templates
lineinfile:
path: /usr/share/sympa/default/create_list.conf
line: '{{ item }} hidden'
state: absent
when: sympa_show_default_templates
loop:
- confidential
- discussion_list
- html-news-letter
- intranet_list
- private_working_group
- public_web_forum
- hotline
- news-letter
- name: Create datasources
copy:
content: "{{ item.content }}"
dest: "/etc/sympa/data_sources/{{ item.name}}.incl"
owner: sympa
group: sympa
mode: 0600
loop: "{{ sympa_data_sources }}"
- name: Create auth.conf
template:
src: auth.conf.j2
dest: /etc/sympa/auth.conf
owner: sympa
group: sympa
mode: 0600
notify: Restart sympa
- name: Create topics.conf
template:
src: topics.conf.j2
dest: /etc/sympa/topics.conf
owner: sympa
group: sympa
mode: 0600
notify: Restart sympa
- name: Add cron job to reload config regularly
become_user: sympa
cron:
name: "sympa_reload_conf"
minute: "0"
hour: "2"
job: "/usr/lib/sympa/bin/sympa.pl --reload_list_config"