From e2c7b1305ca8495065dcf40fd2092d7c698dd6ea Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Tue, 20 Mar 2018 15:47:51 +0100 Subject: Local volumes and StatefulSet to provision Master/Slave MySQL and Galera cluster --- roles/ands_facts/tasks/main.yml | 8 ++++++++ roles/ands_facts/tasks/node.yml | 5 +++++ roles/ands_facts/tasks/nodes.yml | 10 ++++++++++ roles/ands_facts/tasks/volume.yml | 8 ++++++++ roles/ands_facts/tasks/volumes.yml | 7 +++++++ roles/ands_facts/tasks/volumes_iterate.yml | 13 +++++++++++++ 6 files changed, 51 insertions(+) create mode 100644 roles/ands_facts/tasks/node.yml create mode 100644 roles/ands_facts/tasks/nodes.yml create mode 100644 roles/ands_facts/tasks/volume.yml create mode 100644 roles/ands_facts/tasks/volumes.yml create mode 100644 roles/ands_facts/tasks/volumes_iterate.yml (limited to 'roles/ands_facts/tasks') 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 -- cgit v1.2.3