From a3dc7aa00cd3e61cc66c12c678fa2a4dad8b2182 Mon Sep 17 00:00:00 2001 From: James Slagle Date: Wed, 24 Jul 2019 16:26:39 -0400 Subject: [PATCH] Restore AllNodesExtraMapData Commit a7661065743086961b8ef93056b810e7d2a49eda removed the all-nodes-config.j2.yaml Heat template. This template had the support for specifying hieradata to merge into the all_nodes hieradata via the AllNodesExtraMapData. This commit restores the merge logic so that the merged hieradata from the parameter value and the calculated hieradata is rendered in all_nodes.json. Change-Id: I890bbef764b6bae7cb71cfedaff2ce17829737fb Depends-On: Ib3838d404b45ae6684ef7e0aa211cb8015271866 --- roles/tripleo-hieradata/templates/all_nodes.j2 | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/roles/tripleo-hieradata/templates/all_nodes.j2 b/roles/tripleo-hieradata/templates/all_nodes.j2 index a42eebb39..969fa9b45 100644 --- a/roles/tripleo-hieradata/templates/all_nodes.j2 +++ b/roles/tripleo-hieradata/templates/all_nodes.j2 @@ -1,27 +1,29 @@ { - "enabled_services": {{ enabled_services | unique | to_nice_json }}, + {% set all_enabled_services = (enabled_services + all_nodes_extra_map_data['enabled_services'] | default([])) | unique %} - {% for service in enabled_services %} + "enabled_services": {{ all_enabled_services | to_nice_json }}, + + {% for service in all_enabled_services %} {# _enabled: true #} {{ '"' ~ service ~ '_enabled": true,' }} {# _node_ips: #} - {{ '"' ~ service ~ '_node_ips": ' ~ (groups[service] | default ([]) | map('extract', hostvars, service_net_map[service ~ '_network'] | default('ctlplane') ~ '_ip') | list | to_json) ~ ',' }} + {{ '"' ~ service ~ '_node_ips": ' ~ ((groups[service] | default ([]) | map('extract', hostvars, service_net_map[service ~ '_network'] | default('ctlplane') ~ '_ip') | list + all_nodes_extra_map_data[service ~ '_node_ips'] | default([])) | to_json) ~ ',' }} {% if nova_additional_cell %} {# _cell_node_names: #} {{ '"' ~ service ~ '_cell_node_names": ' ~ (groups[service] | default ([]) | map('extract', hostvars, service_net_map[service ~ '_network'] | default('ctlplane') ~ '_hostname') | list | to_json) ~ ',' }} {% else %} {# _node_names: #} - {{ '"' ~ service ~ '_node_names": ' ~ (groups[service] | default ([]) | map('extract', hostvars, service_net_map[service ~ '_network'] | default('ctlplane') ~ '_hostname') | list | to_json) ~ ',' }} + {{ '"' ~ service ~ '_node_names": ' ~ ((groups[service] | default ([]) | map('extract', hostvars, service_net_map[service ~ '_network'] | default('ctlplane') ~ '_hostname') | list + all_nodes_extra_map_data[service ~ '_node_names'] | default([])) | to_json) ~ ',' }} {% endif %} {# _short_node_names: #} - {{ '"' ~ service ~ '_short_node_names": ' ~ (groups[service] | default ([]) | map('extract', hostvars, 'inventory_hostname') | list | to_json) ~ ',' }} + {{ '"' ~ service ~ '_short_node_names": ' ~ ((groups[service] | default ([]) | map('extract', hostvars, 'inventory_hostname') | list + all_nodes_extra_map_data[service ~ '_short_node_names'] | default([])) | to_json) ~ ',' }} {# _short_bootstrap_node_name: hostname #} - {% set services = (groups[service] | default ([]) | map('extract', hostvars, 'inventory_hostname')) | list %} + {% set services = (groups[service] | default ([]) | map('extract', hostvars, 'inventory_hostname')) | list + [all_nodes_extra_map_data[service ~ '_short_bootstrap_node_name'] | default('') ] %} {% if (services | length) > 0 %} {{ '"' ~ service ~ '_short_bootstrap_node_name": ' ~ (services | first | to_json) ~ ',' }} {% endif %} @@ -29,7 +31,7 @@ {# _bootstrap_node_ip: ip #} {% set services = (groups[service] | default ([]) | map('extract', hostvars, service_net_map[service ~ '_network'] | default('ctlplane') ~ '_ip')) | list %} {% if (services | length) > 0 %} - {{ '"' ~ service ~ '_bootstrap_node_ip": ' ~ (services | first | to_json) ~ ',' }} + {{ '"' ~ service ~ '_bootstrap_node_ip": ' ~ ((services + [all_nodes_extra_map_data[service ~ '_bootstrap_node_ip'] | default('')]) | first | to_json) ~ ',' }} {% endif %} {% endfor %}