Choose first node as bootstrap node name/ip
Previously when Heat was choosing the bootstrap node, it always chose the first node due to the ResourceGroup ordering. When it was switched to ansible, the last node was chosen instead due to unpredictable dict sorting from the inventory. This patch restores the previous behavior and makes sure the first node in a group is chosen as the bootstrap node for the both the name and ip if the sorted_bootstrap_node variable is set. The variable is used so that the tripleo-heat-templates patch and this patch can merge, otherwise they'd block each other from merging. See I6b93f5b0747c5a11d24615a3bbb5516f9be81401 for the tripleo-heat-templates patch. Change-Id: I3d595ea5b84f940a3b2dbc69798f69fe03529c10
This commit is contained in:
parent
7137cae523
commit
eb5bfcf187
@ -195,6 +195,7 @@ provisioner:
|
||||
zaqar_api_network: ctlplane
|
||||
stack_action: CREATE
|
||||
stack_update_type: ''
|
||||
tripleo_role_name: Standalone
|
||||
validate_controllers_icmp: true
|
||||
validate_fqdn: false
|
||||
validate_gateways_icmp: true
|
||||
|
@ -15,12 +15,26 @@
|
||||
{# <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([])) %}
|
||||
{# <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 %}
|
||||
{% 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 %}
|
||||
{# <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 %}
|
||||
{% set _ = all_nodes.__setitem__((service ~ '_bootstrap_node_ip'), (services | first)) %}
|
||||
{% endif %}
|
||||
|
@ -1,4 +1,8 @@
|
||||
{% 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 #}
|
||||
{{ boostrap_node | to_nice_json }}
|
||||
|
Loading…
Reference in New Issue
Block a user