Add tripleo_overcloud_roles_show role
Change-Id: I359df050ca598028bdefc6b336ccbd9a4c8ee0f2 Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
This commit is contained in:
parent
85271df1d3
commit
8821471c60
|
@ -0,0 +1,57 @@
|
|||
tripleo_overcloud_roles_show
|
||||
============================
|
||||
|
||||
A role to run roles show.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
None.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
* `tripleo_overcloud_roles_show_debug`: (Boolean) Flag used to enable the debug version of commands. Default: false
|
||||
* `tripleo_overcloud_roles_show_generate_scripts`: (Boolean) Write out a shell script that can be used to reproduce the command being executed. By default uses the value of `tripleo_generate_scripts` or False if `tripleo_generate_scripts` is not defined.
|
||||
* `tripleo_overcloud_roles_show_home_dir`: (String) Home directory to where the command is run from. Default: "{{ ansible_env.HOME }}"
|
||||
* `tripleo_overcloud_roles_show_role`: Role to display more information about.
|
||||
* `tripleo_overcloud_roles_show_name`: The name of the plan, which is used for the object storage container,
|
||||
workflow environment and orchestration stack names.
|
||||
* `tripleo_overcloud_roles_show_os_cloud`: (String) OS_CLOUD value to use when running the command. If `tripleo_os_cloud` is defined, it will be the default.
|
||||
Otherwise the default is ''. This variable takes precedence over `tripleo_overcloud_roles_show_rc_file`.
|
||||
* `tripleo_overcloud_roles_show_rc_file`: (String) Path to the credential file to use. If `tripleo_rc_file` is defined, it will be the default. Default: "{{ ansible_env.HOME }}/stackrc"
|
||||
|
||||
NOTE: Please note that this command should be run against the undercloud so the
|
||||
OS_CLOUD or rc file variables should be set to use the 'undercloud' when
|
||||
calling this role. If you are not defining `tripleo_os_cloud` or `tripleo_rc_file`,
|
||||
stackrc will be used by default.
|
||||
|
||||
Output Variables
|
||||
----------------
|
||||
|
||||
* `tripleo_overcloud_roles_show_output`: (String) The command standard output.
|
||||
* `tripleo_overcloud_roles_show_result`: Ansible shell execution results
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
None.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Example overcloud roles show playbook
|
||||
|
||||
```yaml
|
||||
- hosts: undercloud
|
||||
gather_facts: true
|
||||
tasks:
|
||||
- name: Show roles
|
||||
import_role:
|
||||
name: tripleo_overcloud_roles_show
|
||||
```
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Apache-2.0
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
# defaults file for tripleo_overcloud_roles_show
|
||||
openstack_bin: openstack
|
||||
tripleo_overcloud_roles_show_generate_scripts: "{{ tripleo_generate_scripts | default(False) }}"
|
||||
tripleo_overcloud_roles_show_home_dir: "{{ ansible_env.HOME }}"
|
||||
tripleo_overcloud_roles_show_debug: false
|
||||
tripleo_overcloud_roles_show_role:
|
||||
tripleo_overcloud_roles_show_name: overcloud
|
||||
tripleo_overcloud_roles_show_os_cloud: "{{ tripleo_os_cloud | default('') }}"
|
||||
tripleo_overcloud_roles_show_rc_file: "{{ tripleo_rc_file | default(ansible_env.HOME ~ '/stackrc') }}"
|
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
# Copyright 2019 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_overcloud_roles_show
|
||||
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,64 @@
|
|||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
collections:
|
||||
- tripleo.operator
|
||||
tasks:
|
||||
|
||||
- name: "Include tripleo_overcloud_roles_show"
|
||||
include_role:
|
||||
name: "tripleo_overcloud_roles_show"
|
||||
vars:
|
||||
openstack_bin: echo
|
||||
tripleo_overcloud_roles_show_debug: true
|
||||
tripleo_os_cloud: undercloud
|
||||
|
||||
- name: Check role
|
||||
assert:
|
||||
that:
|
||||
- tripleo_overcloud_roles_show_output == "overcloud roles show --name overcloud"
|
||||
|
||||
- name: Check parameter "tripleo_overcloud_roles_show_role"
|
||||
include_role:
|
||||
name: "tripleo_overcloud_roles_show"
|
||||
vars:
|
||||
openstack_bin: echo
|
||||
tripleo_os_cloud: undercloud
|
||||
tripleo_overcloud_roles_show_debug: true
|
||||
tripleo_overcloud_roles_show_role: value
|
||||
|
||||
- name: Assert "tripleo_overcloud_roles_show_role"
|
||||
assert:
|
||||
that:
|
||||
- tripleo_overcloud_roles_show_output == "overcloud roles show --role value --name overcloud"
|
||||
|
||||
- name: Check parameter "tripleo_overcloud_roles_show_name"
|
||||
include_role:
|
||||
name: "tripleo_overcloud_roles_show"
|
||||
vars:
|
||||
openstack_bin: echo
|
||||
tripleo_os_cloud: undercloud
|
||||
tripleo_overcloud_roles_show_debug: true
|
||||
tripleo_overcloud_roles_show_name: value
|
||||
|
||||
- name: Assert "tripleo_overcloud_roles_show_name"
|
||||
assert:
|
||||
that:
|
||||
- tripleo_overcloud_roles_show_output == "overcloud roles show --name value"
|
||||
|
||||
|
||||
- name: Check all parameters for role tripleo_overcloud_roles_show
|
||||
include_role:
|
||||
name: "tripleo_overcloud_roles_show"
|
||||
vars:
|
||||
openstack_bin: echo
|
||||
tripleo_os_cloud: undercloud
|
||||
tripleo_overcloud_roles_show_debug: true
|
||||
tripleo_overcloud_roles_show_role: value
|
||||
tripleo_overcloud_roles_show_name: value
|
||||
|
||||
- name: Assert all parameters for role tripleo_overcloud_roles_show
|
||||
assert:
|
||||
that:
|
||||
- tripleo_overcloud_roles_show_output ==
|
||||
"overcloud roles show --role value --name value"
|
|
@ -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,39 @@
|
|||
---
|
||||
# tasks file for tripleo_overcloud_roles_show
|
||||
- name: Setup overcloud roles show command
|
||||
set_fact:
|
||||
_show_cmd: >-
|
||||
{{ tripleo_overcloud_roles_show_os_cloud | ternary('', "source " ~ tripleo_overcloud_roles_show_rc_file ~ "; ") }}
|
||||
{{ openstack_bin }} overcloud roles show
|
||||
{{ tripleo_overcloud_roles_show_role | ternary('--role ' ~ tripleo_overcloud_roles_show_role, '') }}
|
||||
{{ tripleo_overcloud_roles_show_name | ternary('--name ' ~ tripleo_overcloud_roles_show_name, '') }}
|
||||
_show_env:
|
||||
OS_CLOUD: "{{ tripleo_overcloud_roles_show_os_cloud }}"
|
||||
|
||||
- name: Show debug information
|
||||
when: tripleo_overcloud_roles_show_debug|bool
|
||||
block:
|
||||
- name: Show the roles show command
|
||||
debug:
|
||||
var: _show_cmd
|
||||
|
||||
- name: Show the roles show environment
|
||||
debug:
|
||||
var: _show_env
|
||||
|
||||
- name: Write reproducer script
|
||||
tripleo_shell_script:
|
||||
dest: "{{ tripleo_overcloud_roles_show_home_dir }}/tripleo_overcloud_roles_show.sh"
|
||||
shell_command: "{{ _show_cmd }}"
|
||||
shell_environment: "{{ _show_env }}"
|
||||
when: tripleo_overcloud_roles_show_generate_scripts|bool
|
||||
|
||||
- name: Show roles
|
||||
shell: "{{ _show_cmd }}" # noqa 305
|
||||
environment: "{{ _show_env }}"
|
||||
register: tripleo_overcloud_roles_show_result
|
||||
changed_when: true
|
||||
|
||||
- name: Set output fact
|
||||
set_fact:
|
||||
tripleo_overcloud_roles_show_output: "{{ tripleo_overcloud_roles_show_result.stdout }}"
|
|
@ -0,0 +1 @@
|
|||
localhost
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
- hosts: localhost
|
||||
roles:
|
||||
- tripleo_overcloud_roles_show
|
|
@ -44,6 +44,7 @@
|
|||
- tripleo-operator-molecule-tripleo_overcloud_node_provision
|
||||
- tripleo-operator-molecule-tripleo_overcloud_node_unprovision
|
||||
- tripleo-operator-molecule-tripleo_overcloud_raid_create
|
||||
- tripleo-operator-molecule-tripleo_overcloud_roles_show
|
||||
- tripleo-operator-molecule-tripleo_overcloud_update_converge
|
||||
- tripleo-operator-molecule-tripleo_overcloud_update_prepare
|
||||
- tripleo-operator-molecule-tripleo_overcloud_update_run
|
||||
|
@ -100,6 +101,7 @@
|
|||
- tripleo-operator-molecule-tripleo_overcloud_node_provision
|
||||
- tripleo-operator-molecule-tripleo_overcloud_node_unprovision
|
||||
- tripleo-operator-molecule-tripleo_overcloud_raid_create
|
||||
- tripleo-operator-molecule-tripleo_overcloud_roles_show
|
||||
- tripleo-operator-molecule-tripleo_overcloud_update_converge
|
||||
- tripleo-operator-molecule-tripleo_overcloud_update_prepare
|
||||
- tripleo-operator-molecule-tripleo_overcloud_update_run
|
||||
|
@ -651,6 +653,20 @@
|
|||
vars:
|
||||
tox_extra_args: tripleo_overcloud_node_discover
|
||||
|
||||
- job:
|
||||
files:
|
||||
- ^roles/tripleo_overcloud_roles_show/.*
|
||||
- ^bindep.txt
|
||||
- ^galaxy.yml
|
||||
- ^requirements.txt
|
||||
- ^setup.cfg
|
||||
- ^test-requirements.txt
|
||||
- ^tox.ini
|
||||
name: tripleo-operator-molecule-tripleo_overcloud_roles_show
|
||||
parent: tripleo-operator-molecule-base
|
||||
vars:
|
||||
tox_extra_args: tripleo_overcloud_roles_show
|
||||
|
||||
- job:
|
||||
files:
|
||||
- ^roles/tripleo_container_image_prepare/.*
|
||||
|
|
Loading…
Reference in New Issue