kayobe/ansible/roles/kolla-ansible/templates/overcloud-top-level.j2
Mark Goddard 6b47717c43 Make local kolla-ansible Python executable configurable
The default is still Python 2. This is a necessary prerequisite for using
the master branch of kolla-ansible, which requires Python 3.

Change-Id: Ida5b60b723c8208bb7305c3d669eafdab6dbbe01
Story: 2004959
Task: 38767
2020-02-14 14:54:23 +00:00

71 lines
2.4 KiB
Django/Jinja

# This inventory section provides a mapping of the top level groups to hosts.
#
# Top level groups define the roles of hosts, e.g. controller or compute.
# Components define groups of services, e.g. nova or ironic.
# Services define single containers, e.g. nova-compute or ironic-api.
{% if ansible_os_family == 'RedHat' and ansible_distribution_major_version | int == 7 and kolla_ansible_venv_python_major_version | int == 3 %}
# TODO(mgoddard): Remove when CentOS 7 is no longer supported.
# Force the use of python2 for localhost. This is necessary for delegate_to:
# localhost, which will otherwise use the playbook python interpreter
# (python3). On CentOS 7, that fails due to a lack of python3 bindings for
# SELinux. https://bugs.centos.org/view.php?id=16389
localhost ansible_python_interpreter=/usr/bin/python2
{% endif %}
{% for group in kolla_overcloud_top_level_groups %}
# Top level {{ group }} group.
[{{ group }}]
# These hostnames must be resolvable from your deployment host
{% for host in groups.get(group, []) %}
{{ host }}
{% endfor %}
{% endfor %}
[overcloud:children]
{% for group in kolla_overcloud_top_level_groups %}
{{ group }}
{% endfor %}
[overcloud:vars]
ansible_user={{ kolla_ansible_user }}
{% if kolla_ansible_become | bool %}
ansible_become=true
{% endif %}
{% if kolla_ansible_target_venv is not none %}
# Execute ansible modules on the remote target hosts using a virtualenv.
ansible_python_interpreter={{ kolla_ansible_target_venv }}/bin/python
{% endif %}
{% for kolla_group, kolla_group_config in kolla_overcloud_inventory_top_level_group_map.items() %}
{% if 'groups' in kolla_group_config %}
{% set renamed_groups = kolla_group_config.groups | difference([kolla_group]) | list %}
{% if renamed_groups | length > 0 %}
# Mapping from kolla-ansible group {{ kolla_group }} to top level kayobe
# groups.
[{{ kolla_group }}:children]
{% for group in kolla_group_config.groups %}
{{ group }}
{% endfor %}
{% endif %}
{% endif %}
{% if 'vars' in kolla_group_config %}
# Mapping from kolla-ansible group {{ kolla_group }} to top level kayobe
# variables.
[{{ kolla_group }}:vars]
{% for var_name, var_value in kayobe_group_config.vars.items() %}
{{ var_name }}={{ var_value }}
{% endfor %}
{% endif %}
{% endfor %}
{% for group in kolla_overcloud_inventory_kolla_top_level_groups %}
{% if not kolla_overcloud_inventory_top_level_group_map.get(group, {}).get('groups') %}
# Empty group definition for {{ group }}.
[{{ group }}]
{% endif %}
{% endfor %}