Add tripleo_overcloud_roles_list role
Change-Id: I23537cbee5c8682e054e2feba7a5505628337374 Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
This commit is contained in:
parent
8821471c60
commit
4ecdc9f44a
|
@ -0,0 +1,56 @@
|
|||
tripleo_overcloud_roles_list
|
||||
============================
|
||||
|
||||
A role to run roles list.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
None.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
* `tripleo_overcloud_roles_list_debug`: (Boolean) Flag used to enable the debug version of commands. Default: false
|
||||
* `tripleo_overcloud_roles_list_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_list_home_dir`: (String) Home directory to where the command is run from. Default: "{{ ansible_env.HOME }}"
|
||||
* `tripleo_overcloud_roles_list_name`: The name of the plan, which is used for the object storage container, workflow environment and orchestration stack names.
|
||||
* `tripleo_overcloud_roles_list_detail`: Include details about each role.
|
||||
* `tripleo_overcloud_roles_list_current`: Only show the information for the roles currently enabled for the plan.
|
||||
* `tripleo_overcloud_roles_list_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_list_rc_file`.
|
||||
* `tripleo_overcloud_roles_list_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_list_output`: (String) The command standard output.
|
||||
* `tripleo_overcloud_roles_list_result`: Ansible shell execution results
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
None.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Example overcloud roles list playbook
|
||||
|
||||
```yaml
|
||||
- hosts: undercloud
|
||||
gather_facts: true
|
||||
tasks:
|
||||
- name: List roles
|
||||
import_role:
|
||||
name: tripleo_overcloud_roles_list
|
||||
```
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Apache-2.0
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
# defaults file for tripleo_overcloud_roles_list
|
||||
openstack_bin: openstack
|
||||
tripleo_overcloud_roles_list_generate_scripts: "{{ tripleo_generate_scripts | default(False) }}"
|
||||
tripleo_overcloud_roles_list_home_dir: "{{ ansible_env.HOME }}"
|
||||
tripleo_overcloud_roles_list_debug: false
|
||||
tripleo_overcloud_roles_list_name:
|
||||
tripleo_overcloud_roles_list_detail: false
|
||||
tripleo_overcloud_roles_list_current: false
|
||||
tripleo_overcloud_roles_list_os_cloud: "{{ tripleo_os_cloud | default('') }}"
|
||||
tripleo_overcloud_roles_list_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_list
|
||||
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,71 @@
|
|||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
collections:
|
||||
- tripleo.operator
|
||||
vars:
|
||||
openstack_bin: echo
|
||||
tripleo_os_cloud: undercloud
|
||||
tripleo_overcloud_roles_list_debug: true
|
||||
tasks:
|
||||
|
||||
- name: "Include tripleo_overcloud_roles_list"
|
||||
include_role:
|
||||
name: "tripleo_overcloud_roles_list"
|
||||
vars:
|
||||
openstack_bin: echo
|
||||
tripleo_overcloud_roles_list_debug: true
|
||||
tripleo_os_cloud: undercloud
|
||||
|
||||
- name: Check role
|
||||
assert:
|
||||
that:
|
||||
- tripleo_overcloud_roles_list_output == "overcloud roles list"
|
||||
|
||||
- name: Check parameter "tripleo_overcloud_roles_list_name"
|
||||
include_role:
|
||||
name: "tripleo_overcloud_roles_list"
|
||||
vars:
|
||||
tripleo_overcloud_roles_list_name: value
|
||||
|
||||
- name: Assert "tripleo_overcloud_roles_list_name"
|
||||
assert:
|
||||
that:
|
||||
- tripleo_overcloud_roles_list_output == "overcloud roles list --name value"
|
||||
|
||||
- name: Check parameter "tripleo_overcloud_roles_list_detail"
|
||||
include_role:
|
||||
name: "tripleo_overcloud_roles_list"
|
||||
vars:
|
||||
tripleo_overcloud_roles_list_detail: true
|
||||
|
||||
- name: Assert "tripleo_overcloud_roles_list_detail"
|
||||
assert:
|
||||
that:
|
||||
- tripleo_overcloud_roles_list_output == "overcloud roles list --detail"
|
||||
|
||||
- name: Check parameter "tripleo_overcloud_roles_list_current"
|
||||
include_role:
|
||||
name: "tripleo_overcloud_roles_list"
|
||||
vars:
|
||||
tripleo_overcloud_roles_list_current: true
|
||||
|
||||
- name: Assert "tripleo_overcloud_roles_list_current"
|
||||
assert:
|
||||
that:
|
||||
- tripleo_overcloud_roles_list_output == "overcloud roles list --current"
|
||||
|
||||
|
||||
- name: Check all parameters for role tripleo_overcloud_roles_list
|
||||
include_role:
|
||||
name: "tripleo_overcloud_roles_list"
|
||||
vars:
|
||||
tripleo_overcloud_roles_list_name: value
|
||||
tripleo_overcloud_roles_list_detail: true
|
||||
tripleo_overcloud_roles_list_current: true
|
||||
|
||||
- name: Assert all parameters for role tripleo_overcloud_roles_list
|
||||
assert:
|
||||
that:
|
||||
- tripleo_overcloud_roles_list_output ==
|
||||
"overcloud roles list --name value --detail --current"
|
|
@ -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,40 @@
|
|||
---
|
||||
# tasks file for tripleo_overcloud_roles_list
|
||||
- name: Setup overcloud roles list command
|
||||
set_fact:
|
||||
_list_cmd: >-
|
||||
{{ tripleo_overcloud_roles_list_os_cloud | ternary('', "source " ~ tripleo_overcloud_roles_list_rc_file ~ "; ") }}
|
||||
{{ openstack_bin }} overcloud roles list
|
||||
{{ tripleo_overcloud_roles_list_name | ternary('--name ' ~ tripleo_overcloud_roles_list_name, '') }}
|
||||
{{ tripleo_overcloud_roles_list_detail | ternary('--detail', '') }}
|
||||
{{ tripleo_overcloud_roles_list_current | ternary('--current', '') }}
|
||||
_list_env:
|
||||
OS_CLOUD: "{{ tripleo_overcloud_roles_list_os_cloud }}"
|
||||
|
||||
- name: Show debug information
|
||||
when: tripleo_overcloud_roles_list_debug|bool
|
||||
block:
|
||||
- name: Show the roles list command
|
||||
debug:
|
||||
var: _list_cmd
|
||||
|
||||
- name: Show the roles list environment
|
||||
debug:
|
||||
var: _list_env
|
||||
|
||||
- name: Write reproducer script
|
||||
tripleo_shell_script:
|
||||
dest: "{{ tripleo_overcloud_roles_list_home_dir }}/tripleo_overcloud_roles_list.sh"
|
||||
shell_command: "{{ _list_cmd }}"
|
||||
shell_environment: "{{ _list_env }}"
|
||||
when: tripleo_overcloud_roles_list_generate_scripts|bool
|
||||
|
||||
- name: List roles
|
||||
shell: "{{ _list_cmd }}" # noqa 305
|
||||
environment: "{{ _list_env }}"
|
||||
register: tripleo_overcloud_roles_list_result
|
||||
changed_when: true
|
||||
|
||||
- name: Set output fact
|
||||
set_fact:
|
||||
tripleo_overcloud_roles_list_output: "{{ tripleo_overcloud_roles_list_result.stdout }}"
|
|
@ -0,0 +1 @@
|
|||
localhost
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
- hosts: localhost
|
||||
roles:
|
||||
- tripleo_overcloud_roles_list
|
|
@ -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_list
|
||||
- tripleo-operator-molecule-tripleo_overcloud_roles_show
|
||||
- tripleo-operator-molecule-tripleo_overcloud_update_converge
|
||||
- tripleo-operator-molecule-tripleo_overcloud_update_prepare
|
||||
|
@ -101,6 +102,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_list
|
||||
- tripleo-operator-molecule-tripleo_overcloud_roles_show
|
||||
- tripleo-operator-molecule-tripleo_overcloud_update_converge
|
||||
- tripleo-operator-molecule-tripleo_overcloud_update_prepare
|
||||
|
@ -653,6 +655,20 @@
|
|||
vars:
|
||||
tox_extra_args: tripleo_overcloud_node_discover
|
||||
|
||||
- job:
|
||||
files:
|
||||
- ^roles/tripleo_overcloud_roles_list/.*
|
||||
- ^bindep.txt
|
||||
- ^galaxy.yml
|
||||
- ^requirements.txt
|
||||
- ^setup.cfg
|
||||
- ^test-requirements.txt
|
||||
- ^tox.ini
|
||||
name: tripleo-operator-molecule-tripleo_overcloud_roles_list
|
||||
parent: tripleo-operator-molecule-base
|
||||
vars:
|
||||
tox_extra_args: tripleo_overcloud_roles_list
|
||||
|
||||
- job:
|
||||
files:
|
||||
- ^roles/tripleo_overcloud_roles_show/.*
|
||||
|
|
Loading…
Reference in New Issue