summaryrefslogtreecommitdiffstats
path: root/roles/ands_kaas/tasks/sync.yml
blob: a4febe7ece3e6a2759fd9441281c8436674d1716 (plain)
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
---
- name: Check if already exists
  stat: path="{{ item_dest }}" 
  register: result

- name: "Sync '{{ item_name }}'"
  local_action: synchronize src="{{ item_src }}" dest="{{ remote_path }}/" archive=yes delete=yes
  register: sync
  when: (result.stat.exists == False) or (kaas_resync | default(false)) or (kaas_project_config.resync | default(false))

- name: "Ensure the data is writeable by project pods"
  vars: 
    grp: "{{ kaas_project_config.sync_set_gid }}"
    gid: "{{ ((kaas_project_config.gids | default(kaas_openshift_gids))[grp] is defined) | ternary((kaas_project_config.gids | default(kaas_openshift_gids))[grp].id, grp) }}"
  file: 
    path: "{{ remote_path }}" 
    state: "directory" 
    recurse: "yes"
    mode: "g+w"
    owner: "{{ kaas_project_config.sync_set_uid | default('root') }}"
    group: "{{ gid }}"
  register: chmod
  when:
    - sync | changed
    - kaas_openshift_gid_ranges[kaas_project] is defined
    - kaas_project_config.sync_set_gid | default(false)