Merge "Support additional pass through host variables"

This commit is contained in:
Zuul 2021-05-18 13:24:03 +00:00 committed by Gerrit Code Review
commit 211c68aa6c
4 changed files with 167 additions and 10 deletions

View File

@ -301,23 +301,49 @@ kolla_build_customizations: {}
# Full custom seed inventory contents.
kolla_seed_inventory_custom:
# List of names of host variables to pass through from kayobe hosts to
# List of names of default host variables to pass through from kayobe hosts to
# the kolla-ansible seed host, if set. See also
# kolla_seed_inventory_pass_through_host_vars_map.
kolla_seed_inventory_pass_through_host_vars:
kolla_seed_inventory_pass_through_host_vars_default:
- "ansible_host"
- "ansible_port"
- "ansible_ssh_private_key_file"
- "kolla_api_interface"
- "kolla_bifrost_network_interface"
# List of names of additional host variables to pass through from kayobe hosts
# to the kolla-ansible seed host, if set. See also
# kolla_seed_inventory_pass_through_host_vars_map.
kolla_seed_inventory_pass_through_host_vars_extra: []
# List of names of host variables to pass through from kayobe hosts to
# the kolla-ansible seed host, if set. See also
# kolla_seed_inventory_pass_through_host_vars_map.
kolla_seed_inventory_pass_through_host_vars: >-
{{ kolla_seed_inventory_pass_through_host_vars_default +
kolla_seed_inventory_pass_through_host_vars_extra }}
# Dict mapping names of default variables in
# kolla_seed_inventory_pass_through_host_vars to the variable to use in
# kolla-ansible. If a variable name is not in this mapping the kayobe name is
# used.
kolla_seed_inventory_pass_through_host_vars_map_default:
kolla_api_interface: "api_interface"
kolla_bifrost_network_interface: "bifrost_network_interface"
# Dict mapping names of extra variables in
# kolla_seed_inventory_pass_through_host_vars to the variable to use in
# kolla-ansible. If a variable name is not in this mapping the kayobe name is
# used.
kolla_seed_inventory_pass_through_host_vars_map_extra: {}
# Dict mapping names of variables in
# kolla_seed_inventory_pass_through_host_vars to the variable to use in
# kolla-ansible. If a variable name is not in this mapping the kayobe name is
# used.
kolla_seed_inventory_pass_through_host_vars_map:
kolla_api_interface: "api_interface"
kolla_bifrost_network_interface: "bifrost_network_interface"
kolla_seed_inventory_pass_through_host_vars_map: >-
{{ kolla_seed_inventory_pass_through_host_vars_map_default |
combine(kolla_seed_inventory_pass_through_host_vars_map_extra) }}
# Custom overcloud inventory containing a mapping from top level groups to
# hosts.
@ -370,10 +396,10 @@ kolla_overcloud_inventory_kolla_top_level_groups:
- "storage"
- "deployment"
# List of names of host variables to pass through from kayobe hosts to
# List of names of default host variables to pass through from kayobe hosts to
# kolla-ansible hosts, if set. See also
# kolla_overcloud_inventory_pass_through_host_vars_map.
kolla_overcloud_inventory_pass_through_host_vars:
kolla_overcloud_inventory_pass_through_host_vars_default:
- "ansible_host"
- "ansible_port"
- "ansible_ssh_private_key_file"
@ -391,11 +417,23 @@ kolla_overcloud_inventory_pass_through_host_vars:
- "kolla_neutron_external_interfaces"
- "kolla_neutron_bridge_names"
# Dict mapping names of variables in
# List of names of additional host variables to pass through from kayobe hosts
# to kolla-ansible hosts, if set. See also
# kolla_overcloud_inventory_pass_through_host_vars_map.
kolla_overcloud_inventory_pass_through_host_vars_extra: []
# List of names of host variables to pass through from kayobe hosts to
# kolla-ansible hosts, if set. See also
# kolla_overcloud_inventory_pass_through_host_vars_map.
kolla_overcloud_inventory_pass_through_host_vars: >-
{{ kolla_overcloud_inventory_pass_through_host_vars_default +
kolla_overcloud_inventory_pass_through_host_vars_extra }}
# Dict mapping names of default variables in
# kolla_overcloud_inventory_pass_through_host_vars to the variable to use in
# kolla-ansible. If a variable name is not in this mapping the kayobe name is
# used.
kolla_overcloud_inventory_pass_through_host_vars_map:
kolla_overcloud_inventory_pass_through_host_vars_map_default:
kolla_network_interface: "network_interface"
kolla_api_interface: "api_interface"
kolla_storage_interface: "storage_interface"
@ -409,6 +447,20 @@ kolla_overcloud_inventory_pass_through_host_vars_map:
kolla_neutron_external_interfaces: "neutron_external_interface"
kolla_neutron_bridge_names: "neutron_bridge_name"
# Dict mapping names of additional variables in
# kolla_overcloud_inventory_pass_through_host_vars to the variable to use in
# kolla-ansible. If a variable name is not in this mapping the kayobe name is
# used.
kolla_overcloud_inventory_pass_through_host_vars_map_extra: {}
# Dict mapping names of variables in
# kolla_overcloud_inventory_pass_through_host_vars to the variable to use in
# kolla-ansible. If a variable name is not in this mapping the kayobe name is
# used.
kolla_overcloud_inventory_pass_through_host_vars_map: >-
{{ kolla_overcloud_inventory_pass_through_host_vars_map_default |
combine(kolla_overcloud_inventory_pass_through_host_vars_map_extra) }}
###############################################################################
# Kolla-ansible configuration.

View File

@ -413,7 +413,11 @@ Host variables
Kayobe generates a host_vars file for each host in the Kolla Ansible
inventory. These contain network interfaces and other host-specific
things.
things. Some Kayobe Ansible variables are passed through to Kolla Ansible, as
defined by the following variables. The default set of variables should
typically be kept. Additional variables may be passed through via the
``*_extra`` variables, as described below. If a passed through variable is not
defined for a host, it is ignored.
``kolla_seed_inventory_pass_through_host_vars``
List of names of host variables to pass through from kayobe hosts to the
@ -429,6 +433,9 @@ things.
- "kolla_api_interface"
- "kolla_bifrost_network_interface"
It is possible to extend this list via
``kolla_seed_inventory_pass_through_host_vars_extra``.
``kolla_seed_inventory_pass_through_host_vars_map``
Dict mapping names of variables in
``kolla_seed_inventory_pass_through_host_vars`` to the variable to use in
@ -441,6 +448,9 @@ things.
kolla_api_interface: "api_interface"
kolla_bifrost_network_interface: "bifrost_network_interface"
It is possible to extend this dict via
``kolla_seed_inventory_pass_through_host_vars_map_extra``.
``kolla_overcloud_inventory_pass_through_host_vars``
List of names of host variables to pass through from Kayobe hosts to
Kolla Ansible hosts, if set. See also
@ -466,6 +476,9 @@ things.
- "kolla_neutron_external_interfaces"
- "kolla_neutron_bridge_names"
It is possible to extend this list via
``kolla_overcloud_inventory_pass_through_host_vars_extra``.
``kolla_overcloud_inventory_pass_through_host_vars_map``
Dict mapping names of variables in
``kolla_overcloud_inventory_pass_through_host_vars`` to the variable to use
@ -488,6 +501,41 @@ things.
kolla_neutron_external_interfaces: "neutron_external_interface"
kolla_neutron_bridge_names: "neutron_bridge_name"
It is possible to extend this dict via
``kolla_overcloud_inventory_pass_through_host_vars_map_extra``.
Example: pass through an additional host variable
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In this example we pass through a variable named ``my_kayobe_var`` from Kayobe
to Kolla Ansible.
.. code-block:: yaml
:caption: ``$KAYOBE_CONFIG_PATH/kolla.yml``
kolla_overcloud_inventory_pass_through_host_vars_extra:
- my_kayobe_var
This variable might be defined in the Kayobe inventory, e.g.
.. code-block:: yaml
:caption: ``$KAYOBE_CONFIG_PATH/inventory/host_vars/controller01``
my_kayobe_var: foo
The variable may then be referenced in
``$KAYOBE_CONFIG_PATH/kolla/globals.yml``, Kolla Ansible group variables, or in
Kolla Ansible custom service configuration.
In case the variable requires a different name in Kolla Ansible, use
``kolla_overcloud_inventory_pass_through_host_vars_map_extra``:
.. code-block:: yaml
:caption: ``$KAYOBE_CONFIG_PATH/kolla.yml``
kolla_overcloud_inventory_pass_through_host_vars_map_extra:
my_kayobe_var: my_kolla_ansible_var
Custom Group Variables
----------------------

View File

@ -121,11 +121,33 @@
# Full custom seed inventory contents.
#kolla_seed_inventory_custom:
# List of names of default host variables to pass through from kayobe hosts to
# the kolla-ansible seed host, if set. See also
# kolla_seed_inventory_pass_through_host_vars_map.
#kolla_seed_inventory_pass_through_host_vars_default:
# List of names of additional host variables to pass through from kayobe hosts
# to the kolla-ansible seed host, if set. See also
# kolla_seed_inventory_pass_through_host_vars_map.
#kolla_seed_inventory_pass_through_host_vars_extra:
# List of names of host variables to pass through from kayobe hosts to
# the kolla-ansible seed host, if set. See also
# kolla_seed_inventory_pass_through_host_vars_map.
#kolla_seed_inventory_pass_through_host_vars:
# Dict mapping names of default variables in
# kolla_seed_inventory_pass_through_host_vars to the variable to use in
# kolla-ansible. If a variable name is not in this mapping the kayobe name is
# used.
#kolla_seed_inventory_pass_through_host_vars_map_default:
# Dict mapping names of extra variables in
# kolla_seed_inventory_pass_through_host_vars to the variable to use in
# kolla-ansible. If a variable name is not in this mapping the kayobe name is
# used.
#kolla_seed_inventory_pass_through_host_vars_map_extra:
# Dict mapping names of variables in
# kolla_seed_inventory_pass_through_host_vars to the variable to use in
# kolla-ansible. If a variable name is not in this mapping the kayobe name is
@ -158,11 +180,33 @@
# have no hosts mapped to them will be provided with an empty group definition.
#kolla_overcloud_inventory_kolla_top_level_groups:
# List of names of default host variables to pass through from kayobe hosts to
# kolla-ansible hosts, if set. See also
# kolla_overcloud_inventory_pass_through_host_vars_map.
#kolla_overcloud_inventory_pass_through_host_vars_default:
# List of names of additional host variables to pass through from kayobe hosts
# to kolla-ansible hosts, if set. See also
# kolla_overcloud_inventory_pass_through_host_vars_map.
#kolla_overcloud_inventory_pass_through_host_vars_extra:
# List of names of host variables to pass through from kayobe hosts to
# kolla-ansible hosts, if set. See also
# kolla_overcloud_inventory_pass_through_host_vars_map.
#kolla_overcloud_inventory_pass_through_host_vars:
# Dict mapping names of default variables in
# kolla_overcloud_inventory_pass_through_host_vars to the variable to use in
# kolla-ansible. If a variable name is not in this mapping the kayobe name is
# used.
#kolla_overcloud_inventory_pass_through_host_vars_map_default:
# Dict mapping names of additional variables in
# kolla_overcloud_inventory_pass_through_host_vars to the variable to use in
# kolla-ansible. If a variable name is not in this mapping the kayobe name is
# used.
#kolla_overcloud_inventory_pass_through_host_vars_map_extra:
# Dict mapping names of variables in
# kolla_overcloud_inventory_pass_through_host_vars to the variable to use in
# kolla-ansible. If a variable name is not in this mapping the kayobe name is

View File

@ -0,0 +1,13 @@
---
features:
- |
Adds support for passing through additional host variables from Kayobe to
Kolla Ansible. This is done via the following variables:
* ``kolla_seed_inventory_pass_through_host_vars_extra``
* ``kolla_seed_inventory_pass_through_host_vars_map_extra``
* ``kolla_overcloud_inventory_pass_through_host_vars_extra``
* ``kolla_overcloud_inventory_pass_through_host_vars_map_extra``
See `story 2008797 <https://storyboard.openstack.org/#!/story/2008797>`__
for details.