Before this patch, all the available Ansible variables for each
validations coming from tripleo-validations were considered as
'metadata' which should only contain the following informations:
```
vars:
metadata:
name: ...
description: ...
groups: ...
```
This patch clarifies this by classifying all the potential variables as
'parameters' instead of 'metadata'.
Change-Id: I7b65b73722ebe0462eb86265197b456e8c77ed13
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
All the Ansible variables in the validations playbooks must be at the
same level as the metadata and not part of them.
```
- hosts: myhost
vars:
metadata:
name: Validation name
description: What should this validation do...
groups:
- prep
- pre-deployment
variable1: "value1"
variable2: "value2"
...
```
Change-Id: Ib3d9ea8d9f85ea194a16feacb530d50419d7e54a
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
All the validations were failing when running through Mistral with a
`sudo` command not allowed issue [1] due to a typo in the file name.
This patch fixes the name of the temporary files containing potential
ansible variables.
[1] mistral : command not allowed ; TTY=unknown ; PWD=/ ; USER=root
; COMMAND=/usr/bin/chown -h validations: /tmp/validation_inputs_PoJRZa
Change-Id: I6699bbbab5cb15a8fd200c144a3d575e9f29ca37
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
The tripleo-common sudoers file allows an owner change on the
validations identity file. The command is only allowed with the `-h`
option, but this option isn't used in the `write_inputs_file` python
code. This breaks validation runs started through Mistral.
This patch adds this option to the `chown` command. It also removes an
useless line in the sudoers file.
Change-Id: Idd3098cfa3aab5dd618645e54b922f90cd9ae13f
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
* Uploads now the contents of tripleo-validations/playbooks directory
instead of tripleo-validations/validations ones.
* Adds a new parameter to run-validation script to be able to properly
export Ansible variables:
- ANSIBLE_CALLBACK_PLUGINS
- ANSIBLE_LOOKUP_PLUGINS
- ANSIBLE_ROLES_PATH
- ANSIBLE_LIBRARY
Change-Id: I43cf796b0147a9b2054d3ff7941274a7497a14d9
Implements: blueprint validation-framework
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
The validations have certain values (e.g. the amount of RAM necessary
for the undercloud node) configurable, but these were not exposed
through Mistral.
This adds a new `--inputs` parameter to the `run-validation` script
which takes a path to a YAML or JSON file with the additional
inputs (i.e. Ansible extra-args) defined.
And the `run_validation` action now optionally takes an `inputs`
dictionary which gets passed to `run-validation`.
Closes-Bug: #1625547
Implements: blueprint validation-framework
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
Change-Id: I8944cf7133d47869d26974fd123cd93c98425f17
Co-authored: Tomas Sedovic <tsedovic@redhat.com>
To properly handle the differences between python2/python3 we need to
ensure that when we interact with swift and are dealing with string data
that we handle the types correctly. This change adds a swift utils
helper to call to get the string data from an object out of swift. For
example our json and yaml files are all strings so if we try to use
something like json.dumps() from data we pull from swift, it errors
because we're given a bytes like object in python3.
Change-Id: I7996cc08cdd3bddf3f4ba0fb2e48f926f944c0dd
Related-Blueprint: python3-support
This patch introduces support for running custom validations by changing
the behavior of the validations actions ListValidationsAction,
ListGroupsAction and RunValidationAction.
Until now, these actions sourced validations from a directory on disk.
Now, these action are sourcing validations from the plan container
subdirectory (custom validations), or, if this is not available, from
the Swift container holding the default validations.
Change-Id: I9e9131b355312c53f12d154976d5d9cd706cc338
Implements: blueprint custom-validations
Depends-On: I338e139fa770ebb7bdcc1c0afb79eec062fada8b
This change will allow the current changes in the sudoers file to
execute correctly. The fix will match how sudo expects the workflow
call to be performed.
Change-Id: I5b790820bcec207ff7ceff1a23b3ed22858e5a52
mistral_lib base TripleoAction has a context in the run method
signature. These changes remove the mistral.context and make use
of the one provide by the default executor
Change-Id: Ib1a5aa8d5735b05f5308dc943ac088b5eeeec253
This reuses the existing password generation mistral action to generate an ssh
keypair to be used for nova cold migration
Paramiko is used to generate the ssh key, based on the existing approach in the
nova keypair api.
Also update validation ssh key generation to reuse the same method.
Change-Id: I9e7a1862911312ad942233ac8fc828f4e1be1dcf
By default the plan name is used on the creation of the node name
in the form of plan_name + role + index
Forcing the plan name to be only letters and numbers removes the
possibility of a failed deploy due to an invalid node name
I've included a pattern validator to verify that those names are valid
and a constant for node and plan name validation
Change-Id: I111d0ba43d810657aa0b76b6ea4afd5175be1d30
Closes-Bug: #1644587
This commit adds support for selecting plan (overcloud) against which
to run validations, configurable with the `plan` variable in relevant
mistral actions.
The `run-validation` wrapper now accept the plan name as a second
argument and pass it to Ansible dynamic inventory script via
TRIPLEO_PLAN_NAME variable. The default plan remains `overcloud`.
Change-Id: Icebf91360f387d7f558c2b5a6a5a4decb5a89093
This commit adds a workflow to run ansible validations.
Validations can be run individually or by group, and the result is sent
over the specified zaqar queue.
Change-Id: Iba8b210c83e94eaa340d34e17ad2b0278ecc4e53
Depends-On: I807fed12e9a42a71c130f393370ff4152831c27b
The new tripleo.validations.v1.copy_ssh_keys workflow copies the
provided public key to the overcloud nodes in preparation for running
ansible validations.
When no public key exists, a new one will be generated and stored in
a dedicated mistral environment.
Change-Id: I93972b34186ac3aaf54fa6aebd14bf48b5247266