Merge "Choose first node as bootstrap node name/ip"

This commit is contained in:
Zuul 2019-08-28 16:25:20 +00:00 committed by Gerrit Code Review
commit cdde584700
3 changed files with 23 additions and 4 deletions

View File

@ -195,6 +195,7 @@ provisioner:
zaqar_api_network: ctlplane zaqar_api_network: ctlplane
stack_action: CREATE stack_action: CREATE
stack_update_type: '' stack_update_type: ''
tripleo_role_name: Standalone
validate_controllers_icmp: true validate_controllers_icmp: true
validate_fqdn: false validate_fqdn: false
validate_gateways_icmp: true validate_gateways_icmp: true

View File

@ -15,12 +15,26 @@
{# <service>_short_node_names: <list of hostnames> #} {# <service>_short_node_names: <list of hostnames> #}
{% set _ = all_nodes.__setitem__((service ~ '_short_node_names'), (groups[service] | default ([]) | map('extract', hostvars, 'inventory_hostname') | list) + all_nodes_extra_map_data[service ~ '_short_node_names'] | default([])) %} {% set _ = all_nodes.__setitem__((service ~ '_short_node_names'), (groups[service] | default ([]) | map('extract', hostvars, 'inventory_hostname') | list) + all_nodes_extra_map_data[service ~ '_short_node_names'] | default([])) %}
{# <service>_short_bootstrap_node_name: hostname #} {# <service>_short_bootstrap_node_name: hostname #}
{% set services = (groups[service] | default ([]) | map('extract', hostvars, 'inventory_hostname')) | list + [all_nodes_extra_map_data[service ~ '_short_bootstrap_node_name'] | default('')] %} {% set services = (groups[service] | default ([]) | list ) %}
{% if all_nodes_extra_map_data[service ~ '_short_bootstrap_node_name'] is defined %}
{% set services = services + all_nodes_extra_map_data[service ~ '_short_bootstrap_node_name'] %}
{% endif %}
{% if (services | length) > 0 %} {% if (services | length) > 0 %}
{% set _ = all_nodes.__setitem__((service ~ '_short_bootstrap_node_name'), (services | first)) %} {% if sorted_bootstrap_node | default(false) %}
{% set _ = all_nodes.__setitem__((service ~ '_short_bootstrap_node_name'), (services | sort | first)) %}
{% else %}
{% set _ = all_nodes.__setitem__((service ~ '_short_bootstrap_node_name'), (services | first)) %}
{% endif %}
{% endif %} {% endif %}
{# <service>_bootstrap_node_ip: hostname #} {# <service>_bootstrap_node_ip: hostname #}
{% set services = (groups[service] | default ([]) | map('extract', hostvars, service_net_map[service ~ '_network'] | default('ctlplane') ~ '_ip')) | list + [all_nodes_extra_map_data[service ~ '_short_bootstrap_node_ip'] | default('')] %} {% if sorted_bootstrap_node | default(false) %}
{% set services = (groups[service] | default ([]) | sort | map('extract', hostvars, service_net_map[service ~ '_network'] | default('ctlplane') ~ '_ip')) | list %}
{% else %}
{% set services = (groups[service] | default ([]) | map('extract', hostvars, service_net_map[service ~ '_network'] | default('ctlplane') ~ '_ip')) | list %}
{% endif %}
{% if all_nodes_extra_map_data[service ~ '_short_bootstrap_node_ip'] is defined %}
{% set services = services + [all_nodes_extra_map_data[service ~ '_short_bootstrap_node_ip']] %}
{% endif %}
{% if (services | length) > 0 %} {% if (services | length) > 0 %}
{% set _ = all_nodes.__setitem__((service ~ '_bootstrap_node_ip'), (services | first)) %} {% set _ = all_nodes.__setitem__((service ~ '_bootstrap_node_ip'), (services | first)) %}
{% endif %} {% endif %}

View File

@ -1,4 +1,8 @@
{% set boostrap_node = {} %} {% set boostrap_node = {} %}
{% set _ = boostrap_node.__setitem__('boostrap_node_id', bootstrap_nodeid) %} {% if sorted_bootstrap_node | default(false) %}
{% set _ = boostrap_node.__setitem__('boostrap_node_id', groups[tripleo_role_name] | sort | first) %}
{% else %}
{% set _ = boostrap_node.__setitem__('boostrap_node_id', groups[tripleo_role_name] | first) %}
{% endif %}
{# RENDER #} {# RENDER #}
{{ boostrap_node | to_nice_json }} {{ boostrap_node | to_nice_json }}