tripleo-common/roles/tripleo-hieradata/templates/all_nodes.j2
James Slagle a3dc7aa00c 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
2019-08-06 05:52:51 +00:00

63 lines
3.1 KiB
Django/Jinja

{
{% set all_enabled_services = (enabled_services + all_nodes_extra_map_data['enabled_services'] | default([])) | unique %}
"enabled_services": {{ all_enabled_services | to_nice_json }},
{% for service in all_enabled_services %}
{# <service>_enabled: true #}
{{ '"' ~ service ~ '_enabled": true,' }}
{# <service>_node_ips: <list of ips> #}
{{ '"' ~ 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 %}
{# <service>_cell_node_names: <list of hostnames> #}
{{ '"' ~ service ~ '_cell_node_names": ' ~ (groups[service] | default ([]) | map('extract', hostvars, service_net_map[service ~ '_network'] | default('ctlplane') ~ '_hostname') | list | to_json) ~ ',' }}
{% else %}
{# <service>_node_names: <list of hostnames> #}
{{ '"' ~ 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 %}
{# <service>_short_node_names: <list of hostnames> #}
{{ '"' ~ 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) ~ ',' }}
{# <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('') ] %}
{% if (services | length) > 0 %}
{{ '"' ~ service ~ '_short_bootstrap_node_name": ' ~ (services | first | to_json) ~ ',' }}
{% endif %}
{# <service>_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 + [all_nodes_extra_map_data[service ~ '_bootstrap_node_ip'] | default('')]) | first | to_json) ~ ',' }}
{% endif %}
{% endfor %}
{# <service>_network: <network> #}
{% for service, network in service_net_map.items() %}
{{ '"' ~ service ~ '": "' ~ network ~ '",' }}
{% endfor %}
{% if 'redis' in enabled_services %}
"redis_vip": "{{ net_vip_map.redis }}",
{% endif %}
{{ '"deploy_identifier": "' ~ deploy_identifier ~ '"' }},
{{ '"stack_action": "' ~ stack_action ~ '"' }},
{{ '"stack_update_type": "' ~ stack_update_type ~ '"' }},
{{ '"container_cli": "' ~ container_cli ~ '"' }},
{{ '"controller_node_ips": "' ~ groups[primary_role_name] | default([]) | map('extract', hostvars, 'ctlplane_ip') | list | join(',') ~ '"' }},
{{ '"controller_node_names": "' ~ groups[primary_role_name] | default([]) | map('extract', hostvars, 'inventory_hostname') | list | join(',') ~ '"' }}
}