TripleO Ansible project repository. Contains playbooks for use with TripleO OpenStack deployments.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

69 lines
4.5 KiB

{% set all_nodes = {} %}
{% set all_enabled_services = ((enabled_services + all_nodes_extra_map_data['enabled_services'] | default ([])) | unique) %}
{% set _ = all_nodes.__setitem__('enabled_services', all_enabled_services) %}
{% for service in all_enabled_services %}
{# <service>_enabled: true #}
{% set _ = all_nodes.__setitem__((service ~ '_enabled'), true) %}
{# <service>_node_ips: <list of ips> #}
{% set _ = all_nodes.__setitem__((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([])) %}
{% if nova_additional_cell %}
{# <service>_cell_node_names: <list of hostnames> #}
{% set _ = all_nodes.__setitem__((service ~ '_cell_node_names'), (groups[service] | default ([]) | map('extract', hostvars, service_net_map[service ~ '_network'] | default('ctlplane') ~ '_hostname') | list)) %}
{% else %}
{# <service>_node_names: <list of hostnames> #}
{% set _ = all_nodes.__setitem__((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([])) %}
{% endif %}
{# <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 ([]) | 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 | sort | first)) %}
{% endif %}
{# <service>_bootstrap_node_ip: hostname #}
{% 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 %}
{% if (services | length) > 0 %}
{% set _ = all_nodes.__setitem__((service ~ '_bootstrap_node_ip'), (services | first)) %}
{% endif %}
{% endfor %}
{# <service>_network: <network> #}
{% for key, value in service_net_map.items() %}
{% set _ = all_nodes.__setitem__(key, value) %}
{% endfor %}
{% if nova_additional_cell %}
{% for key, value in all_nodes_extra_map_data.items() %}
{% set _ = all_nodes.__setitem__(key, value) %}
{% endfor %}
{% endif %}
{% if 'redis' in all_enabled_services or nova_additional_cell %}
{% if 'redis_vip' in all_nodes_extra_map_data %}
{% set _ = all_nodes.__setitem__('redis_vip', all_nodes_extra_map_data['redis_vip']) %}
{% elif net_vip_map.redis is defined %}
{% set _ = all_nodes.__setitem__('redis_vip', (net_vip_map.redis)) %}
{% elif service_vip_vars.redis is defined %}
{% set _ = all_nodes.__setitem__('redis_vip', (service_vip_vars.redis)) %}
{% endif %}
{% endif %}
{% if 'ovn_dbs' in all_enabled_services or nova_additional_cell %}
{% if 'ovn_dbs_vip' in all_nodes_extra_map_data %}
{% set _ = all_nodes.__setitem__('ovn_dbs_vip', all_nodes_extra_map_data['ovn_dbs_vip']) %}
{% elif service_vip_vars.ovn_dbs is defined %}
{% set _ = all_nodes.__setitem__('ovn_dbs_vip', (service_vip_vars.ovn_dbs)) %}
{% elif net_vip_map.ovn_dbs is defined %}
{% set _ = all_nodes.__setitem__('ovn_dbs_vip', (net_vip_map.ovn_dbs)) %}
{% endif %}
{% endif %}
{% set _ = all_nodes.__setitem__('deploy_identifier', deploy_identifier) %}
{% set _ = all_nodes.__setitem__('stack_action', stack_action) %}
{% set _ = all_nodes.__setitem__('stack_update_type', stack_update_type) %}
{% set _ = all_nodes.__setitem__('container_cli', container_cli) %}
{% set _ = all_nodes.__setitem__('controller_node_ips', (groups[primary_role_name] | default([]) | map('extract', hostvars, 'ctlplane_ip') | list | join(','))) %}
{% set _ = all_nodes.__setitem__('controller_node_names', (groups[primary_role_name] | default([]) | map('extract', hostvars, 'inventory_hostname') | list | join(','))) %}
{# RENDER #}
{{ all_nodes | to_nice_json }}