diff options
Diffstat (limited to 'roles/ands_facts')
-rw-r--r-- | roles/ands_facts/defaults/main.yml | 8 | ||||
-rw-r--r-- | roles/ands_facts/tasks/main.yml | 8 | ||||
-rw-r--r-- | roles/ands_facts/tasks/network.yml | 16 | ||||
-rw-r--r-- | roles/ands_facts/tasks/storage.yml | 8 |
4 files changed, 28 insertions, 12 deletions
diff --git a/roles/ands_facts/defaults/main.yml b/roles/ands_facts/defaults/main.yml index fc3fcfd..c74984e 100644 --- a/roles/ands_facts/defaults/main.yml +++ b/roles/ands_facts/defaults/main.yml @@ -3,6 +3,11 @@ ands_none: "{{ None }}" ands_configure_heketi: false ands_data_device_default_threshold: 10 +ands_host_id: "{{ ansible_hostname | regex_replace('^[\\w\\d]*\\w(\\d+)(\\.|$)', '\\1') }}" +# We need to add it to set_fact if enabled +#ands_master_id: "{{ ('masters' in group_names) | ternary(groups.masters.index(('masters' in group_names) | ternary(inventory_hostname, groups.masters[0])), -1) }}" + +ands_storage_hostname: "{{ ands_storage_network | default(false) | ternary(ands_storage_network | default('') | ipaddr(ands_host_id) | ipaddr('address'), ansible_fqdn) }}" ands_storage_servers: "{{ groups.ands_storage_servers | map('extract', hostvars, 'ands_storage_hostname') | list }}" #openshift_storage_nodes: "{{ groups.storage_nodes | map('extract', hostvars, 'ands_storage_hostname') | list }}" @@ -23,7 +28,8 @@ ands_default_ip: "{{ ansible_default_ipv4.address }}" ands_openshift_default_ip: "{{ ands_resolve_public_ip | default(false) | ternary(ands_default_ip, ands_none) }}" ands_openshift_default_hostname: "{{ (ands_hostname_template is defined) | ternary(ands_hostname_template ~ ands_host_id, ansible_hostname) }}" -ands_inner_lb: false +ands_inner_lb: true +ands_use_inner_lb: false ands_inner_lb_id: 254 ands_inner_lb_hostname: 'ands-lb' diff --git a/roles/ands_facts/tasks/main.yml b/roles/ands_facts/tasks/main.yml index 6b28683..bd23e13 100644 --- a/roles/ands_facts/tasks/main.yml +++ b/roles/ands_facts/tasks/main.yml @@ -1,14 +1,14 @@ --- +# Here we set 'openshift_hostname', 'openshift_ip' and other variables +- name: "Configuring network facts" + include_tasks: "network.yml" # The variables accessed trough 'hostvars' should be set as facts # Here we set 'ands_storage_servers' and other variables - name: "Configuring storage facts" include_tasks: "storage.yml" -# Here we set 'openshift_hostname', 'openshift_ip' and other variables -- name: "Configuring network facts" - include_tasks: "network.yml" - - name: "Confirm that ands facts are configured" set_fact: + ands_none: "{{ ands_none }}" ands_facts_configured: true diff --git a/roles/ands_facts/tasks/network.yml b/roles/ands_facts/tasks/network.yml index 1d0248f..808d7b6 100644 --- a/roles/ands_facts/tasks/network.yml +++ b/roles/ands_facts/tasks/network.yml @@ -1,24 +1,34 @@ +- name: Set some facts + set_fact: + ands_host_id: "{{ ands_host_id }}" + - name: Set network facts set_fact: ands_cluster_domain: "{{ ands_cluster_domain }}" ands_cluster_dot_domain: ".{{ ands_cluster_domain }}" ands_inner_domain: "{{ ands_inner_domain }}" ands_inner_dot_domain: "{{ (ands_inner_domain == ands_none) | ternary('', '.' ~ ands_inner_domain) }}" + ands_inner_lb: "{{ ands_inner_lb }}" + ands_use_inner_lb: "{{ ands_use_inner_lb }}" ands_inner_lb_ip: "{{ ands_openshift_network | ipaddr(ands_inner_lb_id) | ipaddr('address') }}" ands_inner_lb_hostname: "{{ ands_inner_lb_hostname }}" ands_openshift_ip: "{{ ands_openshift_network | ipaddr(ands_host_id) | ipaddr('address') }}" - ands_openshift_hostname: "{{ ands_openshift_hostname | default(ands_openshift_set_hostname | ternary(ands_openshift_default_hostname, ands_none)) }}" + ands_openshift_hostname: "{{ ands_openshift_hostname | default(ands_openshift_default_hostname) }}" ands_openshift_public_ip: "{{ (ands_openshift_public_network is defined) | ternary( ands_openshift_public_network | ipaddr(ands_host_id) | ipaddr('address'), ands_openshift_default_ip) }}" - ands_openshift_public_hostname: "{{ ands_openshift_public_hostname | default(ands_openshift_set_public_hostname | ternary(ands_openshift_default_hostname, ands_none)) }}" + ands_openshift_public_hostname: "{{ ands_openshift_public_hostname | default(ands_openshift_default_hostname) }}" ands_storage_ip: "{{ ands_storage_network | default(ands_openshift_network) | ipaddr(ands_host_id) | ipaddr('address') }}" ands_hostname_storage: "ands_storage{{ ands_host_id }}" ands_hostname_openshift: "ands_openshift{{ ands_host_id }}" + ands_openshift_set_hostname: "{{ ands_openshift_set_hostname }}" + ands_openshift_set_public_hostname: "{{ ands_openshift_set_public_hostname }}" + ands_storage_hostname: "{{ ands_storage_hostname }}" - name: Set more network facts set_fact: ands_openshift_public_fqdn: "{{ (ands_openshift_public_hostname == ands_none) | ternary(ands_none, ands_openshift_public_hostname ~ ands_cluster_dot_domain ) }}" ands_openshift_fqdn: "{{ (ands_openshift_hostname == ands_none) | ternary(ands_none, ands_openshift_hostname ~ ands_inner_dot_domain ) }}" - ands_openshift_cluster_fqdn: "{{ ands_inner_lb | ternary(ands_inner_lb_hostname ~ ands_inner_dot_domain, ands_openshift_lb) }}" + ands_inner_lb_fqdn: "{{ ands_inner_lb_hostname ~ ands_inner_dot_domain }}" + ands_storage_servers: "{{ ands_storage_servers }}" - name: "Detect inner network interface" include_tasks: "find_interface_by_ip.yml" diff --git a/roles/ands_facts/tasks/storage.yml b/roles/ands_facts/tasks/storage.yml index cf995a0..888ad70 100644 --- a/roles/ands_facts/tasks/storage.yml +++ b/roles/ands_facts/tasks/storage.yml @@ -1,5 +1,9 @@ - include_vars: dir="vars" +- name: Set facts + set_fact: + ands_configure_heketi: "{{ ands_configure_heketi }}" + - name: Detect Heketi set_fact: ands_storage_domains="{{ ands_storage_domains | union([ands_heketi_domain]) }}" when: @@ -9,10 +13,6 @@ - name: Set some facts set_fact: - ands_storage_servers: "{{ ands_storage_servers }}" - -- name: Set some facts - set_fact: ands_data_vg: "{{ ands_data_vg }}" when: ands_data_vg != "" |