Support additional pass through host variables

Allow passing through additional host variables from Kayobe to Kolla
Ansible without overriding the entire list.

* 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

Story: 2008797
Task: 42201

Change-Id: I41d9169f0312108e42bb12c52c6c7ee2509cf2ab
This commit is contained in:
Mark Goddard 2021-04-01 17:41:12 +01:00
parent f8575af9c0
commit 45a7963810
4 changed files with 167 additions and 10 deletions

View File

@ -300,23 +300,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.
@ -369,10 +395,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"
@ -390,11 +416,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"
@ -408,6 +446,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

@ -120,11 +120,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
@ -157,11 +179,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.