tripleo-ansible-inventory is broken in Master/Wallaby and need to be revisit
to what tripleo is actually deploying:
* tripleo-deploy directory contains a valid inventory
* tripleo-ansible with the playbook cli-config-download.yaml offers a way to
regenerate a fresh inventory.
This review also removed the scripts/tripleo-validation.py which is not longer functional
with the current VF CLI.
Change-Id: Ie02259336c763cfa980b59ad64f9e478d05690fb
Closes-Bug: #1936406
Resolves: rhbz#2008426
The utils.list_plan_and_stack function returns None in case of exceptions
or and empty list if no stacks or no plans have been found in the
environment.
This patch fixes the conditional to allow the tripleo-ansible-inventory
script to generate only the undercloud Inventory when no Overcloud has
been deployed.
Related-bz: rhbz#1987318
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
Change-Id: If0dc3300fbd8cf245c0477be782110d897344860
There's no reason to forbid --list and --static-yaml-inventory
Also, we should return an error if both --list and --host are
defined.
Change-Id: I94393de4a71a92c12f8d427748853d7ff2ce5a02
The previous statement result to an empty list, this
fix merge the two list and avoid duplicate
Declare auth_variables dictionary to avoid
reference before assignment issues
Change-Id: Ie28357d692f604c647d0f252a932242024e84f6e
Closes-Bug: #1914084
When no overcloud is deployed, we forced to pass the overcloud
hardcoded value to the inventory.
We should, if no --plan or --stack passed, check if there is
plans or stacks on the environment.
If so, used it, if not then just generate undercloud inventory
Depends-On: https://review.opendev.org/c/openstack/tripleo-common/+/765524
Change-Id: Idf4269a2ae5ce9863e1eda2f824e7a9fc93847d2
Switch to new multistack inventory class interface.
Also TRIPLEO_PLAN_NAME did not work for comma seperated list.
Depends-On: Ife14dbe04dd11db44a944f98373f63e01dfbb8d8
Change-Id: I2cc721676005536b14995980f7a042991c92adcc
Related-bug: #1849073
When running under Python 3, the keys() method on a dict returns a
dict_keys object, not a list. The dict_keys object can't be indexed like
a list, so an exception is thrown. This patch switches from using the
keys() method to using list() on the dict instead, which returns a list
of the keys.
Change-Id: Ifb1814f2406318c4c42edc21581a6fc6d34eb91e
Since the default value has been updated to return a list
for the plan_name value, if the os.environ.get is None
then the default is a list with a None value: ['None']
We need to set a real None value, in order to set the
default 'overcloud' value.
Change-Id: Ia84e458c4a79f0a606d15e1b2739b48e5bbda21e
This [1] introduced support tripleo-ansible-inventory for multiple
stacks/plans and now configs.plan needs to be list/iterable.
[1]: I23fdeaa4950244bf3aec8e8ea71e8a29f763c074
Change-Id: I929a3490d88602eaf62bbe1a559febfc185aa7e9
If tripleo-ansible-inventory is called with '--stack foo,bar',
then build an inventory for stack foo and stack bar; then
merge the two inventories into one before writing it out to
an inventory file.
An ansible inventory host group will be created for every
item in the cross product of stacks and roles. For example,
central_Controller, edge0_Compute, edge1_Compute, etc.
Change-Id: I23fdeaa4950244bf3aec8e8ea71e8a29f763c074
Depends-On: I522f1acbd39ad36ae1fec896188d3e20e0575566
Implements: blueprint split-control-plane-unified-inventory
The parameter undercloud_connection is being available as
an input option in the script, however it was not being passed
into the TripleoInventory object instantiation.
Change-Id: Ife819b1d807946c8e53deaacbb8e4f9361009f6e
Closes-Bug: #1832932
This patch fixes the right default for the 'undercloud-connection' option
according to the help message.
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
Co-Authored-By: Jose Luis Franco <jfrancoa@redhat.com>
Change-Id: Ib0eb19ddd2968ab328565dec3171f480327be27f
To enable the execution via ssh into the Undercloud node it's
required to pass also the ansible_ssh_user private key. This
options is part of the tripleo_common inventory.py, but defaults
to None.
This patch allows to pass this parameter in case it's needed.
Also, this patch allows to pass a different value for the host_network
parameter in TripleoInventory instantiation. Setting it by default to
ctlplane.
Change-Id: Id303f356c1b06906aa5aae43b0032bb80a712508
Related-Bug: #1832932
In order to allow the user to override the serial value
for parallel execution on nodes, this review adds the
--serial option to the tripleo-ansible-inventory script
Depends-On: I6605aec1d42a714f2f2c72b9233bc3bf510177de
Change-Id: Icc4fa67b123c5b51c4797ef32e38c0f26c5bfcfa
This script isn't only used for local ansible inventories, it is also
called by tripleoclient commands which then pass the generated
inventory into mistral. This means there need to be the option of
making the undercloud connection use ssh, since this is now what
mistral requires.
Change-Id: If4d877dbb144947347afe1de7a06f623d2db3941
Partial-Bug: #1822518
Depends-On: https://review.openstack.org/#/c/648899/
In order to be able to specify that we would like to use python2 or
python3 with the generated ansible inventory, the
tripleo-ansible-inventory script should take this as a parameter like it
does for the ansible ssh user.
Depends-On: https://review.openstack.org/#/c/617793/
Change-Id: If70d046b3bdb2b0bd9fcc334e53f72e97b127cd7
Related-Blueprint: python3-support
There is no --static-yaml-format option. The patch corrects documentation to
use --static-yaml-inventory option.
Change-Id: Ie4b3b55f5a5f7612bf389bf9be5443181f27fe0f
This change ensures that the inventory script will fail, and not hang,
if the Heat engine is not running.
Change-Id: Ib22a926aca736819cbfbe53fd3c5d53640e462b8
This change removes duplication of service clients instantiations
throughout the code (especially the lookup plugins). It also
consolidates service client getter functions by placing them all
in the utils module.
Change-Id: Ia8ba252de3cebca9e75266f7bcbba373cc0f5008
This reverts commit 773bef1c7a.
The reverted commit made the inventory fail if there was no overcloud
deployed. However, the inventory is also used a lot in cases with no
overcloud (many validations for instance).
Change-Id: I19a4e02d25037f54c2449396ea84492b49555fd6
The standard output was missing in one of the error logs
inside tripleo-ansible-inventory. This made it pretty
hard to debug when ansible-playbook failed due that
inventory script error.
This patch also formats a little the error message to give
some more info about the issue.
Related-Bug: #1768011
Change-Id: Ib240a4626bedb4d2a2d0b51caf696b3728fb7fb0
If tripleo-ansible-inventory can not retrieve the
inventory, the script should fail and
display an error message for the users to
fix the plan or stack name before continuing.
Change-Id: I76fe01b7f2ec84db8a8aeaa749cb7b961667b3c9
Closes-Bug: 1768011
Deprecates static-inventory, as ini formatted inventory no longer works
with role_data values. static-inventory will now return a
static-yaml-inventory file.
Change-Id: I74ae2290f50bac213134e45f1710c1d3c3200b7a
Closes-Bug: 1751855
Adds a debug flag to surface tracebacks on failures.
Also removes .message from exceptions, as this is deprecated in 2.6
and removed in py3.
Change-Id: I7d2cdc37bd134370ff7edcefa3a4589024d5ce9a
Closes-Bug: 1751340
In order to use tripleo-ansible-inventory with a different stack name,
you had to know to specify that name with --plan.
This commit adds help for the --plan cli arg, and also adds a new
--stack cli arg that has the same effect. --stack is more consistent
with other cli tools in TripleO. If both are specified, --stack will
take precedence.
Change-Id: I64b2c66eb2d37f0f231895c0cec3f8415de9f342
Instead pass the individual named parameters, which is clearer
and easier for tests, particularly now that some of these are
optional.
Change-Id: Ic49cccdcd900e0ca97d1f6c4675e865e6357363d
This allows dumping a static inventory in yaml format, which makes
representing vars containing complex data types, e.g lists/maps easier
than with ini format (which only supports string values).
This also makes use of the tripleo-common class that now supports
writing a yaml format static inventory, so we deprecate the old code
and CLI option for later removal.
Change-Id: I38b9e17ef7981c22850b17d7bb8396c8db3a1b0a
This moves the main code/class to tripleo-common, as there is a need
to use this in tripleoclient (which already depends on tripleo-common)
Note we don't move the tripleo-ansible-inventory at this time, since
it's not needed for the tripleoclient use-case and it will require
packaging changes.
Depends-On: I03f609b8ff9f36c95a8382aa1705147d99cb973b
Change-Id: Idd6e8f69788e857bc5a81dae344fb41d5be68846
W/o an env var, a dynamic inventory can't be invoked for a custom
user. Ansible uses the same ANSIBLE_SSH_USER so the value will
be aligned to both.
Related-bug: #1734298
Change-Id: Ieddbb4c87d88888f78d494ff670db907bce4fd78
Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
Changes how the vars and children sections are ordered in the generated
static inventory by tripleo-ansible-inventory. Due to a change in
ansible 2.4, having them in the opposite order caused no hosts to match
the inventory.
See also:
https://github.com/ansible/ansible/issues/32196
Change-Id: I2aa1a04ea8a963b9c613008c12b1efffd365ceaf
implements: blueprint ansible-config-download
Closes-Bug: #1729058
Config parser remove capitalization information when it writes the
configuration file. Make sure to keep by removing any transformation.
Change-Id: I7f46e4b7bdac5110d111537a044473c362d059f6
Closes-Bug: #1712190
Currently tripleo-ansible-inventory --static can create an invalid
inventory file:
The offending line appears to be:
[undercloud]
localhost
^ here
Attempted to read "/home/stack/validations_static_inventory" as ini file: /home/stack/validations_static_inventory:11: Expected key=value, got: cacert
The broken snippet can be:
...
ansible_connection = local
cacert
undercloud_swift_url = https://192.168.24.2:13808/v1/AUTH_ab355edddba843deafef01bf520e8648
...
We need to make sure that keys that have a 'None' dictionary do not
break the inventory file.
Change-Id: I009c7b52a4d1dabc3ceaad14a828f90ff3845b94
Closes-Bug: #1701239
The ansible_ssh_user in the generated inventory by
tripleo-ansible-inventory is now configurable instead
of hardcoded to heat-admin. The default is still heat-admin.
Change-Id: I137d303e0a5555a0c9e138b548560637c619b492
Closes-Bug: #1710240
The overcloud admin password is currently retreived from the mistral
environment. Since this value can also be retreived via heat and the
mistral environment isn't used anywhere else, this change removes the
mistral dependency.
Change-Id: I38233ea71f81e547fed756fbdddf244db594da2f
In some cases it might be useful to just have a static inventory,
since bigger deployments might take a long time to process each
time. This enables the option --static-inventory to the
tripleo-ansible-inventory script, which does just this.
Related-Bug: #1689789
Change-Id: I96a6b1bc17035b116a85e4e560452321123551dc
The class object now just returns the dict, and the responsibility
of printing the json object is now part of the dynamic inventory
script. This separation was done so in a further commit, more options
can be passed to this script.
Related-Bug: #1689789
Change-Id: I51dfd8618b88bcd2d28dbc799dbb4820c6055705
This patch updates the tripleo-ansible-inventory to show all roles in
the host list, not just compute and controller nodes.
The retrieval of IPs and stack outputs is slightly refactored: Instead of
retrieving them from Nova, the host IPs are now read from the stacks new
RoleNetIpMap output. The stack outputs are fetched from heat via a new
`StackOutputs` class that ensures outputs are only fetched when needed.
Closes-Bug: #1685544
Closes-Bug: #1689789
Change-Id: Ic8a19f15dd45b383a3f3d403653e3eaef2c1865b
Using keystone v3, the name of the environment for getting the tenant
changes from PROJECT to TENANT, so it should be reflected in the dynamic
inventory script, else it'll fail.
Change-Id: I755868c4a276806f3568468bebee4dfb3bcf7c7f
This patch adds a lookup plugin for tripleo heat templates
that playbooks can use as: "{{ lookup('tht') }}"
The lookup will return a list of tuples, each tuple
containing the path and the contents of the file.
To implement this the auth token as well as the plan
name have been added to the inventory.
Change-Id: I8ab1563dc887e51339e669592011f2115cfe5e4c
The token authentication in the inventory script currently uses the
`user_domain_id` parameter, which is supposed to be used with password
authentication only.
This patch removed the param.
Change-Id: I5ec5aa386eb267283cc187cf1d4206827e6b3191
Closes-Bug: #1678029
Since novaclient 7.0.0, the tripleo-ansible-inventory silently ignores
a novaclient error and skips all overcloud nodes in its output.
Switching to keystoneauth solves the issue in a clean fashion.
Change-Id: I2019ceebda8bf6bf2e1f01bba9e1d5c143c8738d
Closes-Bug: #1666662
We were reading overcloudrc for the openstack-endpoints validation.
However, the name of tha file may differ if the deployment plan is
called something else than "overcloud" and more importantly, the GUI
deployments don't create the file on the undercloud at all.
This updates the Ansible inventory to read the admin password and
keystone url for the specified plan if available and the validation to
use those values instead of relying on overcloudrc.
Change-Id: I9ff26016c43888267968ef2588f686f7de95bda3
Closes-Bug: #1643808