]> git.somenet.org - root/pub/somesible.git/blob - roles/server/irc-services/tasks/main.yml
roles/base/backup/files
[root/pub/somesible.git] / roles / server / irc-services / 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 anope irc services
9   apt:
10     pkg:
11     - anope
12     state: present
13     policy_rc_d: 101
14   tags: "online"
15   ignore_errors: "{{ignore_online_errors | bool}}"
16
17
18 - name: create anope user
19   user:
20     name: "anope"
21     home: "/srv/anope"
22     shell: "/bin/bash"
23     createhome: no
24     system: yes
25     state: present
26
27
28 - name: create anope user's homedir
29   file:
30     path: "/srv/anope"
31     state: directory
32     mode: 0710
33     owner: "anope"
34     group: "anope"
35
36
37 - name: create anope-db dir
38   file:
39     path: "/srv/anope/db"
40     state: directory
41     mode: 0750
42     owner: "anope"
43     group: "anope"
44
45
46 - name: create anope-db-backup dir
47   file:
48     path: "/srv/anope/db/backups"
49     state: directory
50     mode: 0750
51     owner: "anope"
52     group: "anope"
53
54
55 - name: create anope logdir
56   file:
57     path: "/var/log/anope"
58     state: directory
59     mode: 0750
60     owner: "anope"
61     group: "anope"
62
63
64 - name: copy chanserv.conf config
65   copy:
66     src: "{{item}}"
67     dest: "/etc/anope/chanserv.conf"
68     mode: 0640
69     owner: "anope"
70     group: "anope"
71   with_first_found:
72     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/chanserv.conf"
73     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/chanserv.conf"
74     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/chanserv.conf"
75     - "default/chanserv.conf"
76   notify: reload anope.service
77
78
79 - name: copy global.conf config
80   copy:
81     src: "{{item}}"
82     dest: "/etc/anope/global.conf"
83     mode: 0640
84     owner: "anope"
85     group: "anope"
86   with_first_found:
87     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/global.conf"
88     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/global.conf"
89     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/global.conf"
90     - "default/global.conf"
91   notify: reload anope.service
92
93
94 - name: copy hostserv.conf config
95   copy:
96     src: "{{item}}"
97     dest: "/etc/anope/hostserv.conf"
98     mode: 0640
99     owner: "anope"
100     group: "anope"
101   with_first_found:
102     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/hostserv.conf"
103     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/hostserv.conf"
104     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/hostserv.conf"
105     - "default/hostserv.conf"
106   notify: reload anope.service
107
108
109 - name: copy memoserv.conf config
110   copy:
111     src: "{{item}}"
112     dest: "/etc/anope/memoserv.conf"
113     mode: 0640
114     owner: "anope"
115     group: "anope"
116   with_first_found:
117     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/memoserv.conf"
118     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/memoserv.conf"
119     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/memoserv.conf"
120     - "default/memoserv.conf"
121   notify: reload anope.service
122
123
124 - name: copy modules.conf config
125   copy:
126     src: "{{item}}"
127     dest: "/etc/anope/modules.conf"
128     mode: 0640
129     owner: "anope"
130     group: "anope"
131   with_first_found:
132     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/modules.conf"
133     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/modules.conf"
134     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/modules.conf"
135     - "default/modules.conf"
136   notify: reload anope.service
137
138
139 - name: copy nickserv.conf config
140   copy:
141     src: "{{item}}"
142     dest: "/etc/anope/nickserv.conf"
143     mode: 0640
144     owner: "anope"
145     group: "anope"
146   with_first_found:
147     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/nickserv.conf"
148     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/nickserv.conf"
149     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/nickserv.conf"
150     - "default/nickserv.conf"
151   notify: reload anope.service
152
153
154 - name: copy operserv.conf config
155   copy:
156     src: "{{item}}"
157     dest: "/etc/anope/operserv.conf"
158     mode: 0640
159     owner: "anope"
160     group: "anope"
161   with_first_found:
162     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/operserv.conf"
163     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/operserv.conf"
164     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/operserv.conf"
165     - "default/operserv.conf"
166   notify: reload anope.service
167
168
169 - name: copy services.conf config
170   copy:
171     src: "{{item}}"
172     dest: "/etc/anope/services.conf"
173     mode: 0640
174     owner: "anope"
175     group: "anope"
176   with_first_found:
177     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/services.conf"
178     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/services.conf"
179     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/services.conf"
180     - "default/services.conf"
181   notify: reload anope.service
182
183
184 - name: copy services.motd config
185   copy:
186     src: "{{item}}"
187     dest: "/etc/anope/services.motd"
188     mode: 0640
189     owner: "anope"
190     group: "anope"
191   with_first_found:
192     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/services.motd"
193     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/services.motd"
194     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/services.motd"
195     - "default/services.motd"
196   notify: reload anope.service
197
198
199 - name: copy anope.service to /etc/systemd/system/
200   copy:
201     src: "{{item}}"
202     dest: "/etc/systemd/system/anope.service"
203     mode: 0644
204     owner: "root"
205     group: "root"
206   with_first_found:
207     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/anope.service"
208     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/anope.service"
209     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/anope.service"
210     - "default/anope.service"
211
212
213 - name: enable and start anope.service
214   include_role: name="base/systemd/enable-and-start"
215   vars:
216     service_name: anope.service