blob: d6f1cc5af7b90e7602a4fa9221fd599c0e471a60 (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
- name: Configure KaaS volumes
include_tasks: volume.yml
with_dict: "{{ kaas_project_volumes }}"
loop_control:
loop_var: osv
vars:
vt_query: "[*].volumes.{{osv.value.volume}}.type"
voltypes: "{{ (kaas_storage_domains | json_query(vt_query)) }}"
voltype: "{{ voltypes[0] | default(ands_none) }}"
mp_query: "[*].volumes.{{osv.value.volume}}.mount"
mntpath: "{{ (kaas_storage_domains | json_query(mp_query)) }}"
rp_query: "[*].volumes.{{osv.value.volume}}.path"
realpath: "{{ (kaas_storage_domains | json_query(rp_query)) }}"
osvpath: "{{ osv.value.path | default('') }}"
prefix: "{{ ( osvpath[:1] == '/' ) | ternary('', '/' ~ kaas_project ~ '/') }}"
path: "{{ mntpath[0] ~ prefix ~ osvpath }}"
hostpath: "{{ realpath[0] is defined | ternary((realpath[0] | default('')) ~ prefix ~ osvpath, '') }}"
name: "{{osv.key}}"
volume: "{{osv.value}}"
when:
- ( mntpath | length ) > 0
- (kaas_storage_types is not defined) or (voltype in kaas_storage_types)
- name: Check if static configuration exists
local_action: stat path="{{ kaas_project_path }}/files/"
register: result
# Executed only if complete project is provisioned (not if we just care to provision per-node storage)
- name: Search static configuration
include_tasks: search.yml
when:
- result.stat.exists
- kaas_storage_types is not defined
- name: Configure KaaS files
include_tasks: file.yml
with_items: "{{ kaas_project_config.files | default(kaas_openshift_files) | default([]) }}"
loop_control:
loop_var: file
vars:
osv: "{{ kaas_project_volumes[file.osv] }}"
vt_query: "[*].volumes.{{osv.volume}}.type"
voltypes: "{{ (kaas_storage_domains | json_query(vt_query)) }}"
voltype: "{{ voltypes[0] | default(ands_none) }}"
mp_query: "[*].volumes.{{osv.volume}}.mount"
mntpath: "{{ (kaas_storage_domains | json_query(mp_query)) }}"
rp_query: "[*].volumes.{{osv.volume}}.path"
realpath: "{{ (kaas_storage_domains | json_query(rp_query)) }}"
pvar: "kaas_{{ file.osv }}_path"
path: "{{ hostvars[inventory_hostname][pvar] }}/{{ file.path }}"
hvar: "kaas_{{ file.osv }}_hostpath"
hostpath: "{{ hostvars[inventory_hostname][hvar] }}/{{ file.path }}"
when:
- file.osv in kaas_project_volumes
- (kaas_storage_types is not defined) or (voltype in kaas_storage_types)
|