Always use sorted group for bootstrap node.

Once the tripleo-heat-templates patch has merged, the condition that
checked the sorted_bootstrap_node var can be removed.

Depends-On: I6b93f5b0747c5a11d24615a3bbb5516f9be81401
Change-Id: I4b280bcafce42bba4c823b8205f296b83e2f3e5d
changes/54/678654/5
James Slagle 3 years ago committed by Kevin Carter (cloudnull)
parent 2f6cc5cdff
commit b6f64b06fe
  1. 12
      tripleo_ansible/roles/tripleo-hieradata/templates/all_nodes.j2
  2. 6
      tripleo_ansible/roles/tripleo-hieradata/templates/bootstrap_node.j2

@ -20,18 +20,10 @@
{% set services = services + all_nodes_extra_map_data[service ~ '_short_bootstrap_node_name'] %}
{% endif %}
{% if (services | length) > 0 %}
{% 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 %}
{% set _ = all_nodes.__setitem__((service ~ '_short_bootstrap_node_name'), (services | sort | first)) %}
{% endif %}
{# <service>_bootstrap_node_ip: hostname #}
{% 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 %}
{% set services = (groups[service] | default ([]) | sort | map('extract', hostvars, service_net_map[service ~ '_network'] | default('ctlplane') ~ '_ip')) | list %}
{% 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 %}

@ -1,8 +1,4 @@
{% set boostrap_node = {} %}
{% 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 %}
{% set _ = boostrap_node.__setitem__('boostrap_node_id', groups[tripleo_role_name] | sort | first) %}
{# RENDER #}
{{ boostrap_node | to_nice_json }}

Loading…
Cancel
Save