summaryrefslogtreecommitdiffstats
path: root/roles/ands_kaas/tasks/file.yml
blob: 393fe08870dad5a1766a5101e2fb7fe0b480cf38 (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
27
28
29
30
31
32
---
- name: Set group
  set_fact: group="{{ file.group | default(kaas_project_config.file_group | default(ands_default_file_group)) }}"

- name : Resolve project groups
  set_fact: group="{{ kaas_project_gids[group].id }}"
  when: group in kaas_project_gids

- name: Set owner
  set_fact: owner="{{ file.owner | default(kaas_project_config.file_owner | default(ands_default_file_owner)) }}"

- name : Resolve project uids
  set_fact: owner="{{ kaas_project_uids[owner].id }}"
  when: owner in kaas_project_uids

- name: "Setting up files in {{ path }}"
  file: 
    path: "{{ path }}" 
    recurse: "{{ file.recurse | default(false) }}" 
    mode: "{{ file.mode | default( ((file.state | default('directory')) == 'directory') | ternary('0755', '0644') ) }}"
    owner: "{{ owner }}" 
    group: "{{ group }}"
    state: "{{ file.state | default('directory') }}"


- name: "Setting selinux context in {{ path }}"
  sefcontext: target="{{ hostpath }}" setype="svirt_sandbox_file_t" state="present" reload="yes"
  when: voltype[0] == "host"

- name: "Apply selinux context in {{ path }}"
  shell: restorecon "{{ hostpath }}" 
  when: voltype[0] == "host"