-
Notifications
You must be signed in to change notification settings - Fork 2
/
copy_datafs.yml
45 lines (44 loc) · 1.49 KB
/
copy_datafs.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
# This pull the Data.fs from a production server
- name: copy datafs
hosts: zeo
vars_prompt:
- name: "source_host"
prompt: "Where is the Data.fs hosted?"
private: no
default: "backend1.cnx.org"
- name: "source_location"
prompt: "What directory is the Data.fs located in on the host machine?"
private: no
default: "/opt/instances/cnx/var"
vars:
source_filename: "Data.fs"
source_host: "{{ source_host }}"
source_location: "{{ source_location }}"
destination_filename: "{{ source_filename }}.new"
tasks:
- name: temporary filestorage permissions
become: yes
file:
path: /var/lib/cnx/cnx-buildout/var/filestorage
owner: "{{ ansible_user_id }}"
group: www-data
mode: 0775
tags: datafs-perms-temporary
- name: copy datafs over
shell: "rsync -aP --temp-dir=/tmp/rsync.d --inplace -e ssh {{ source_host }}:{{ source_location }}/{{ source_filename }} /var/lib/cnx/cnx-buildout/var/filestorage/{{ destination_filename }}"
tags: datafs-sync
- name: ensure filestorage permissions
become: yes
file:
path: /var/lib/cnx/cnx-buildout/var/filestorage
owner: www-data
group: www-data
mode: 0755
tags: datafs-perms-reset
- name: ensure datafs permissions
become: yes
file:
path: "/var/lib/cnx/cnx-buildout/var/filestorage/{{ destination_filename }}"
owner: www-data
group: www-data
tags: datafs-perms