zuul-jobs/roles/write-inventory/README.rst
James E. Blair 41d4d6c41d Allow mapping additional hostvars in write-inventory
In OpenDev, we use an inventory file with the public v4 and v6
addresses listed as hostvars.  We would like to use that feature in
testing as well.  In order to do that, we need to mutate the inventory
so that the public_ipv4 address supplied by nodepool is mapped to
the public_v4 address in the inventory.  This additional option allows
the user to configure such mappings.

Change-Id: I48f03cacdf4531c42d33f6e807845d5c2a1da1d5
2020-05-18 12:34:34 -07:00

42 lines
1.3 KiB
ReStructuredText

Write an abbreviated version of the Zuul inventory to a file
This writes the minimal information about hosts from the current Zuul
inventory to a file. It may be used to subsequently invoke Ansible
with the inventory for the job.
**Role Variables**
.. zuul:rolevar:: write_inventory_dest
The path of the inventory file to write.
.. zuul:rolevar:: write_inventory_include_hostvars
:type: list
A list of facts about the host to include. By default this
parameter is omitted and all variables about a host will be
included. To only include certain variables, list them here. The
empty list will cause no variables to be included.
.. zuul:rolevar:: write_inventory_exclude_hostvars
:type: list
A list of facts about the host to exclude. By default, all
variables about a host will be included. To exclude certain
variables, list them here.
.. zuul:rolevar:: write_inventory_additional_hostvars
:type: dict
Additional hostvars to include. This can be used to map
information from nodepool into the inventory if used as follows:
.. code-block:: yaml
write_inventory_additional_hostvars:
public_v4: nodepool.public_ipv4
public_v6: nodepool.public_ipv6
This will map hostvars[hostname]['nodepool']['public_ipv4'] to
hostvars[hostname]['public_v4'].