diff --git a/roles/tripleo_validator_group_info/README.md b/roles/tripleo_validator_group_info/README.md new file mode 100644 index 0000000..16dc0a2 --- /dev/null +++ b/roles/tripleo_validator_group_info/README.md @@ -0,0 +1,44 @@ +tripleo_validator_group_info +================================ + +A role to get info of a tripleo validations group + +Requirements +------------ + +None. + +Role Variables +-------------- + +* `tripleo_validator_group_info_debug`: (Boolean) Flag to print out the debug command. Default: False +* `tripleo_validator_group_info`: (String) Group to gather from + +Output Variables +---------------- + +* `tripleo_validator_group_info_result`: Ansible shell execution results + +Dependencies +------------ + +None. + +Example Playbook +---------------- + +Example validator group info playbook + +```yaml +- hosts: undercloud + gather_facts: true + tasks: + - name: Gather validation group info + import_role: + name: tripleo_validator_group_info +``` + +License +------- + +Apache-2.0 diff --git a/roles/tripleo_validator_group_info/defaults/main.yml b/roles/tripleo_validator_group_info/defaults/main.yml new file mode 100644 index 0000000..227719b --- /dev/null +++ b/roles/tripleo_validator_group_info/defaults/main.yml @@ -0,0 +1,3 @@ +--- +tripleo_validator_group_info_debug: false +tripleo_validator_group_info: [] diff --git a/roles/tripleo_validator_group_info/meta/main.yml b/roles/tripleo_validator_group_info/meta/main.yml new file mode 100644 index 0000000..0a841e4 --- /dev/null +++ b/roles/tripleo_validator_group_info/meta/main.yml @@ -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_group_info + 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: [] diff --git a/roles/tripleo_validator_group_info/molecule/default/converge.yml b/roles/tripleo_validator_group_info/molecule/default/converge.yml new file mode 100644 index 0000000..b757781 --- /dev/null +++ b/roles/tripleo_validator_group_info/molecule/default/converge.yml @@ -0,0 +1,23 @@ +--- +- name: Converge + hosts: all + collections: + - tripleo.operator + vars: + openstack_bin: echo + tripleo_os_cloud: undercloud + tripleo_validator_show_debug: true + tasks: + + - name: Check parameter "tripleo_validator_group_info" as a single element + include_role: + name: "tripleo_validator_group_info" + vars: + tripleo_validator_group_info: + - 'group' + + - name: Assert "tripleo_validator_group_info" + assert: + that: + - tripleo_validator_group_info_result.stdout == + "tripleo validator group info group" diff --git a/roles/tripleo_validator_group_info/molecule/default/molecule.yml b/roles/tripleo_validator_group_info/molecule/default/molecule.yml new file mode 100644 index 0000000..2841806 --- /dev/null +++ b/roles/tripleo_validator_group_info/molecule/default/molecule.yml @@ -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 diff --git a/roles/tripleo_validator_group_info/molecule/default/prepare.yml b/roles/tripleo_validator_group_info/molecule/default/prepare.yml new file mode 100644 index 0000000..63bb6ab --- /dev/null +++ b/roles/tripleo_validator_group_info/molecule/default/prepare.yml @@ -0,0 +1,8 @@ +--- +- name: Prepare + hosts: all + tasks: + + - name: Include molecule prep + include_role: + name: test_molecule_prep diff --git a/roles/tripleo_validator_group_info/tasks/main.yml b/roles/tripleo_validator_group_info/tasks/main.yml new file mode 100644 index 0000000..c8a7115 --- /dev/null +++ b/roles/tripleo_validator_group_info/tasks/main.yml @@ -0,0 +1,36 @@ +--- +- name: Fail if we do not pass group + fail: + msg: "Please pass tripleo_validator_group_info" + when: + - tripleo_validator_group_info | length == 0 + +- name: Setup validator group info facts + set_fact: + _validator_group_info_cmd: >- + {{ openstack_bin }} tripleo validator group info + {{ tripleo_validator_group_info | ternary(' "${TRIPLEO_VALIDATOR_GROUP_INFO}"', '') }} + _validator_group_info_env: + TRIPLEO_VALIDATOR_GROUP_INFO: >- + {%- if tripleo_validator_group_info is string -%} + {{ tripleo_validator_group_info }} + {%- else -%} + {{ tripleo_validator_group_info | join(',') }} + {%- endif -%} + +- name: Show debug information + when: + tripleo_validator_group_info_debug|bool + block: + - name: Show validator group info environment + debug: + var: _validator_group_info_env + - name: Show validator group info command + debug: + var: _validator_group_info_cmd + +- name: Show validation group info + shell: "{{ _validator_group_info_cmd }}" + environment: "{{ _validator_group_info_env }}" + register: tripleo_validator_group_info_result + changed_when: true diff --git a/zuul.d/molecule.yaml b/zuul.d/molecule.yaml index f71e843..a3f9abc 100644 --- a/zuul.d/molecule.yaml +++ b/zuul.d/molecule.yaml @@ -62,6 +62,7 @@ - tripleo-operator-molecule-tripleo_undercloud_minion_install - tripleo-operator-molecule-tripleo_undercloud_minion_upgrade - tripleo-operator-molecule-tripleo_undercloud_upgrade + - tripleo-operator-molecule-tripleo_validator_group_info - tripleo-operator-molecule-tripleo_validator_list - tripleo-operator-molecule-tripleo_validator_run - tripleo-operator-molecule-tripleo_validator_show_parameter @@ -128,6 +129,7 @@ - tripleo-operator-molecule-tripleo_undercloud_minion_install - tripleo-operator-molecule-tripleo_undercloud_minion_upgrade - tripleo-operator-molecule-tripleo_undercloud_upgrade + - tripleo-operator-molecule-tripleo_validator_group_info - tripleo-operator-molecule-tripleo_validator_list - tripleo-operator-molecule-tripleo_validator_run - tripleo-operator-molecule-tripleo_validator_show_parameter @@ -1007,6 +1009,20 @@ vars: tox_extra_args: tripleo_undercloud_upgrade +- job: + files: + - ^roles/tripleo_validator_group_info/.* + - ^bindep.txt + - ^galaxy.yml + - ^requirements.txt + - ^setup.cfg + - ^test-requirements.txt + - ^tox.ini + name: tripleo-operator-molecule-tripleo_validator_group_info + parent: tripleo-operator-molecule-base + vars: + tox_extra_args: tripleo_validator_group_info + - job: files: - ^roles/tripleo_validator_list/.*