diff options
Diffstat (limited to 'roles/ands_facts/tasks')
-rw-r--r-- | roles/ands_facts/tasks/main.yml | 8 | ||||
-rw-r--r-- | roles/ands_facts/tasks/node.yml | 5 | ||||
-rw-r--r-- | roles/ands_facts/tasks/nodes.yml | 10 | ||||
-rw-r--r-- | roles/ands_facts/tasks/volume.yml | 8 | ||||
-rw-r--r-- | roles/ands_facts/tasks/volumes.yml | 7 | ||||
-rw-r--r-- | roles/ands_facts/tasks/volumes_iterate.yml | 13 |
6 files changed, 51 insertions, 0 deletions
diff --git a/roles/ands_facts/tasks/main.yml b/roles/ands_facts/tasks/main.yml index ce5dd23..54c800a 100644 --- a/roles/ands_facts/tasks/main.yml +++ b/roles/ands_facts/tasks/main.yml @@ -13,7 +13,15 @@ - name: "Configuring storage facts" include_tasks: "storage.yml" +- name: "Configuring ands nodes" + include_tasks: "nodes.yml" + +- name: "Configuring ands volumes" + include_tasks: "volumes.yml" + - name: "Confirm that ands facts are configured" set_fact: ands_none: "{{ ands_none }}" ands_facts_configured: true + +#- debug: msg="{{ ands_volume_hostraid_servers }}" diff --git a/roles/ands_facts/tasks/node.yml b/roles/ands_facts/tasks/node.yml new file mode 100644 index 0000000..e30442c --- /dev/null +++ b/roles/ands_facts/tasks/node.yml @@ -0,0 +1,5 @@ +- name: "Associating public host names with ids" + set_fact: "ands_host_{{ host_id }}_public_hostname={{ host.value['ands_openshift_public_hostname'] }}" + +- name: "Associating openshift fqdn with ids" + set_fact: "ands_host_{{ host_id }}_openshift_fqdn={{ host.value['ands_openshift_fqdn'] }}" diff --git a/roles/ands_facts/tasks/nodes.yml b/roles/ands_facts/tasks/nodes.yml new file mode 100644 index 0000000..ebe8091 --- /dev/null +++ b/roles/ands_facts/tasks/nodes.yml @@ -0,0 +1,10 @@ +- name: Process all nodes + include_tasks: "node.yml" + run_once: true + delegate_to: "{{ groups['masters'][0] }}" + with_dict: "{{ hostvars }}" + vars: + host_id: "{{ host.value['ands_host_id'] }}" + host_name: "{{ host.value['ansible_hostname'] }}" + loop_control: + loop_var: host diff --git a/roles/ands_facts/tasks/volume.yml b/roles/ands_facts/tasks/volume.yml new file mode 100644 index 0000000..5ac4af3 --- /dev/null +++ b/roles/ands_facts/tasks/volume.yml @@ -0,0 +1,8 @@ +- name: "Associating volumes with domains" + set_fact: "ands_volume_{{ name }}_domain={{ domain }}" + +- name: "Associating volumes with servers" + set_fact: "ands_volume_{{ name }}_servers={{ domain_servers }}" + +- name: "Associating volumes with servers" + set_fact: "ands_volume_{{ name }}_server_ids={{ domain_server_ids }}" diff --git a/roles/ands_facts/tasks/volumes.yml b/roles/ands_facts/tasks/volumes.yml new file mode 100644 index 0000000..616202c --- /dev/null +++ b/roles/ands_facts/tasks/volumes.yml @@ -0,0 +1,7 @@ +- name: Process all storage domains + include_tasks: "volumes_iterate.yml" + run_once: true + delegate_to: "{{ groups[domain.servers][0] }}" + with_items: "{{ ands_local_storage_domains | default([]) | union(ands_storage_domains) }}" + loop_control: + loop_var: domain diff --git a/roles/ands_facts/tasks/volumes_iterate.yml b/roles/ands_facts/tasks/volumes_iterate.yml new file mode 100644 index 0000000..979e12f --- /dev/null +++ b/roles/ands_facts/tasks/volumes_iterate.yml @@ -0,0 +1,13 @@ +--- +- name: Iterate volumes + include_tasks: "volume.yml" + with_dict: "{{ domain.volumes }}" + vars: + name: "{{ volume.key }}" + path: "{{ volume.value.mount }}" + server_group: "{{ domain.servers }}" + domain_servers: "{{ groups[domain.servers] | map('extract', hostvars, 'ands_storage_hostname') | list }}" + domain_server_ids: "{{ groups[domain.servers] | map('extract', hostvars, 'ands_host_id') | list }}" + when: volume.value.mount is defined + loop_control: + loop_var: volume |