add role to show tripleo validation parameter
With this patch, validator show parameter can be used by operators in automation. Change-Id: I3fa2f91c973cb14980b82a5c89d8082dad2c30d5
This commit is contained in:
parent
b12211cf51
commit
88ec4eb661
|
@ -0,0 +1,46 @@
|
|||
tripleo_validator_show_parameter
|
||||
================================
|
||||
|
||||
A role to show tripleo validations parameters
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
None.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
* `tripleo_validator_show_parameter_debug`: (Boolean) Flag to print out the debug command. Default: False
|
||||
* `tripleo_validator_show_parameter`: (String) Parameter to inspect
|
||||
|
||||
Output Variables
|
||||
----------------
|
||||
|
||||
* `tripleo_validator_show_parameter_result`: Ansible shell execution results
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
None.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Example validator show parameter playbook
|
||||
|
||||
```yaml
|
||||
- hosts: undercloud
|
||||
gather_facts: true
|
||||
tasks:
|
||||
- name: Show validation parameter
|
||||
import_role:
|
||||
name: tripleo_validator_show_parameter
|
||||
var:
|
||||
tripleo_validator_show_parameter: foo
|
||||
```
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Apache-2.0
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
tripleo_validator_show_parameter_debug: false
|
||||
tripleo_validator_show_parameter: []
|
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
# Copyright 2020 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
galaxy_info:
|
||||
author: OpenStack
|
||||
description: TripleO Operator Role -- tripleo_validator_show_parameter
|
||||
company: Red Hat
|
||||
license: Apache-2.0
|
||||
min_ansible_version: 2.8
|
||||
#
|
||||
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||
# To view available platforms and versions (or releases), visit:
|
||||
# https://galaxy.ansible.com/api/v1/platforms/
|
||||
#
|
||||
platforms:
|
||||
- name: CentOS
|
||||
versions:
|
||||
- 7
|
||||
- 8
|
||||
|
||||
galaxy_tags:
|
||||
- tripleo
|
||||
|
||||
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
dependencies: []
|
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
collections:
|
||||
- tripleo.operator
|
||||
vars:
|
||||
openstack_bin: echo
|
||||
tripleo_os_cloud: undercloud
|
||||
tripleo_validator_show_parameter_debug: true
|
||||
tasks:
|
||||
|
||||
- name: Check parameter "tripleo_validator_show_parameter" as a single element
|
||||
include_role:
|
||||
name: "tripleo_validator_show_parameter"
|
||||
vars:
|
||||
tripleo_validator_show_parameter:
|
||||
- 'foo'
|
||||
|
||||
- name: Assert "tripleo_validator_show_parameter"
|
||||
assert:
|
||||
that:
|
||||
- tripleo_validator_show_parameter_result.stdout ==
|
||||
"tripleo validator show parameter foo"
|
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
driver:
|
||||
name: delegated
|
||||
options:
|
||||
managed: false
|
||||
ansible_connection_options:
|
||||
ansible_connection: local
|
||||
log: true
|
||||
platforms:
|
||||
- name: instance
|
||||
provisioner:
|
||||
name: ansible
|
||||
scenario:
|
||||
name: default
|
||||
test_sequence:
|
||||
- prepare
|
||||
- syntax
|
||||
- converge
|
||||
- verify
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
- name: Prepare
|
||||
hosts: all
|
||||
tasks:
|
||||
|
||||
- name: Include molecule prep
|
||||
include_role:
|
||||
name: test_molecule_prep
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
- name: Fail if we do not pass parameter
|
||||
fail:
|
||||
msg: "Please pass tripleo_validator_show_parameter"
|
||||
when:
|
||||
- tripleo_validator_show_parameter | length == 0
|
||||
|
||||
- name: Setup validator show parameter facts
|
||||
set_fact:
|
||||
_validator_show_parameter_cmd: >-
|
||||
{{ openstack_bin }} tripleo validator show parameter
|
||||
{{ tripleo_validator_show_parameter | ternary(' "${TRIPLEO_VALIDATOR_SHOW_PARAMETER}"', '') }}
|
||||
_validator_show_parameter_env:
|
||||
TRIPLEO_VALIDATOR_SHOW_PARAMETER: >-
|
||||
{%- if tripleo_validator_show_parameter is string -%}
|
||||
{{ tripleo_validator_show_parameter }}
|
||||
{%- else -%}
|
||||
{{ tripleo_validator_show_parameter | join(',') }}
|
||||
{%- endif -%}
|
||||
|
||||
- name: Show debug information
|
||||
when:
|
||||
tripleo_validator_show_parameter_debug|bool
|
||||
block:
|
||||
- name: Show validator show parameter environment
|
||||
debug:
|
||||
var: _validator_show_parameter_env
|
||||
- name: Show validator show parameter command
|
||||
debug:
|
||||
var: _validator_show_parameter_cmd
|
||||
|
||||
- name: Show validation parameter
|
||||
shell: "{{ _validator_show_parameter_cmd }}"
|
||||
environment: "{{ _validator_show_parameter_env }}"
|
||||
register: tripleo_validator_show_parameter_result
|
||||
changed_when: true
|
|
@ -64,6 +64,7 @@
|
|||
- tripleo-operator-molecule-tripleo_undercloud_upgrade
|
||||
- tripleo-operator-molecule-tripleo_validator_list
|
||||
- tripleo-operator-molecule-tripleo_validator_run
|
||||
- tripleo-operator-molecule-tripleo_validator_show_parameter
|
||||
|
||||
gate:
|
||||
jobs:
|
||||
|
@ -129,6 +130,7 @@
|
|||
- tripleo-operator-molecule-tripleo_undercloud_upgrade
|
||||
- tripleo-operator-molecule-tripleo_validator_list
|
||||
- tripleo-operator-molecule-tripleo_validator_run
|
||||
- tripleo-operator-molecule-tripleo_validator_show_parameter
|
||||
|
||||
- job:
|
||||
name: tripleo-operator-molecule-base
|
||||
|
@ -1034,3 +1036,17 @@
|
|||
parent: tripleo-operator-molecule-base
|
||||
vars:
|
||||
tox_extra_args: tripleo_validator_run
|
||||
|
||||
- job:
|
||||
files:
|
||||
- ^roles/tripleo_validator_show_parameter/.*
|
||||
- ^bindep.txt
|
||||
- ^galaxy.yml
|
||||
- ^requirements.txt
|
||||
- ^setup.cfg
|
||||
- ^test-requirements.txt
|
||||
- ^tox.ini
|
||||
name: tripleo-operator-molecule-tripleo_validator_show_parameter
|
||||
parent: tripleo-operator-molecule-base
|
||||
vars:
|
||||
tox_extra_args: tripleo_validator_show_parameter
|
||||
|
|
Loading…
Reference in New Issue