forked from usegalaxy-no/infrastructure-playbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcvmfsproxy.yml
298 lines (253 loc) · 5.99 KB
/
cvmfsproxy.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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
- hosts: cvmfsproxy
vars_files:
- secret_group_vars/global.vault
- group_vars/global.yml
- group_vars/env.yml
- group_vars/cvmfsproxy.yml
become: true
vars:
handlers:
- name: restart squid
service:
name: squid
state: restarted
enabled: yes
- name: restart autofs
service:
name: autofs
state: restarted
enabled: yes
tasks:
- name: install packages
package:
name: "{{ item }}"
state: present
with_items:
- squid
- firewalld
tags:
- server
- name: enable and start services
service:
name: "{{ item }}"
state: started
enabled: yes
with_items:
- squid
- firewalld
tags:
- server
- name: opening firewall for public
firewalld:
service: "{{ item }}"
permanent: true
state: enabled
immediate: yes
zone: public
loop: "{{ public_ports }}"
tags:
- server
- name: refresh squid cache
command: /sbin/squid -z
notify: restart squid
changed_when: false
tags:
- server
- name: opening firewall for proxy
firewalld:
service: "{{ item }}"
permanent: true
state: enabled
immediate: yes
zone: internal
loop: "{{ proxy_ports }}"
tags:
- server
- name: add cvmfs clients to firewall
firewalld:
source: "{{ item }}"
zone: internal
state: enabled
permanent: true
immediate: yes
loop: "{{ cvmfs_clients }}"
tags:
- server
- name: copy squid.conf
template:
src: cvmfs/squid.conf.j2
dest: /etc/squid/squid.conf
owner: root
group: squid
mode: 0640
notify: restart squid
tags:
- server
- hosts: galaxyserver
gather_facts: yes
become: true
vars_files:
- secret_group_vars/global.vault
- group_vars/global.yml
- group_vars/env.yml
- group_vars/cvmfsproxy.yml
handlers:
- name: restart autofs
service:
name: autofs
state: restarted
tasks:
- name: remove any old cvmfs proxy lines if exists
lineinfile:
path: /etc/cvmfs/default.local
state: absent
regexp: '^CVMFS_HTTP_PROXY'
backup: yes
tags:
- change_clients
- name: add proxy to cvmfs config
lineinfile:
path: /etc/cvmfs/default.local
line: CVMFS_HTTP_PROXY="{{ cvmfs_proxy }}"
notify:
- restart autofs
tags:
- change_clients
- hosts: slurm
gather_facts: yes
become: true
vars_files:
- secret_group_vars/global.vault
- group_vars/global.yml
- group_vars/env.yml
- group_vars/cvmfsproxy.yml
handlers:
- name: restart autofs
service:
name: autofs
state: restarted
tasks:
- name: install packages
package:
name: "{{ item }}"
state: present
with_items:
- autofs
tags:
- change_clients
- name: create key dir
file:
path: /etc/cvmfs/keys/galaxyproject.org
state: directory
mode: '0755'
tags:
- change_clients
- name: add pub key
copy:
src: cvmfs/data.galaxyproject.org.pub
dest: /etc/cvmfs/keys/galaxyproject.org/data.galaxyproject.org.pub
mode: '0644'
owner: root
group: root
tags:
- change_clients
- name: touch cvmfs.local
file:
path: /etc/cvmfs/default.local
state: touch
mode: '0644'
tags:
- change_clients
- name: remove any old cvmfs fstab lines if exists
lineinfile:
path: /etc/fstab
state: absent
regexp: '^{{ fstab_pattern }}'
backup: yes
tags:
- change_clients
- name: remove any old cvmfs proxy lines if exists
lineinfile:
path: /etc/cvmfs/default.local
state: absent
regexp: '^CVMFS_HTTP_PROXY'
backup: yes
tags:
- change_clients
- name: add proxy to cvmfs config
lineinfile:
path: /etc/cvmfs/default.local
line: CVMFS_HTTP_PROXY="{{ cvmfs_proxy }}"
notify:
- restart autofs
tags:
- change_clients
- name: umount nfs cvmfs
mount:
path: '{{ item }}'
state: unmounted
with_items:
- "/cvmfs/data.galaxyproject.org"
- "/cvmfs/data.usegalaxy.no"
tags:
- change_clients
- name: add cvmfs to autofs
command: cvmfs_config setup
changed_when: false
tags:
- change_clients
- name: enable autofs
service:
name: autofs
state: started
enabled: true
tags:
- change_clients
- hosts: database
gather_facts: yes
become: true
vars_files:
- secret_group_vars/global.vault
- group_vars/global.yml
- group_vars/env.yml
- group_vars/cvmfsproxy.yml
tasks:
- name: touch cvmfs.local
file:
path: /etc/cvmfs/default.local
state: touch
mode: '0644'
tags:
- change_clients
- name: add proxy to cvmfs config
lineinfile:
path: /etc/cvmfs/default.local
line: CVMFS_HTTP_PROXY="{{ cvmfs_proxy }}"
tags:
- change_clients
- name: remount cvmfs
mount:
path: '{{ item }}'
state: remounted
with_items:
- "/var/spool/cvmfs/{{ datausegalaxy }}/rdonly"
- "/cvmfs/{{ datausegalaxy }}"
tags:
- change_clients
- hosts: galaxyserver, slurm
gather_facts: yes
become: true
vars_files:
- secret_group_vars/global.vault
- group_vars/global.yml
- group_vars/env.yml
- group_vars/cvmfsproxy.yml
tasks:
- name: cvmfs probe
command: cvmfs_config probe '{{ item }}'
with_items:
- "data.galaxyproject.org"
- "{{ datausegalaxy }}"
- "cvmfs-config.galaxyproject.org"
tags:
- change_clients