Add tripleo_overcloud_profiles_list role
Change-Id: I918b5661540bd9cbfbfbcf787a51cffb29f7d4a8
This commit is contained in:
59
roles/tripleo_overcloud_profiles_list/README.md
Normal file
59
roles/tripleo_overcloud_profiles_list/README.md
Normal file
@@ -0,0 +1,59 @@
|
||||
tripleo_overcloud_profiles_list
|
||||
===============================
|
||||
|
||||
A role to run profiles list.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
None.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
* `tripleo_overcloud_profiles_list_debug`: (Boolean) Flag used to enable the debug version of commands. Default: false
|
||||
* `tripleo_overcloud_profiles_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_profiles_list_home_dir`: (String) Home directory to where the command is run from. Default: "{{ ansible_env.HOME }}"
|
||||
* `tripleo_overcloud_profiles_list_all`: List all nodes, even those not available to Nova.
|
||||
* `tripleo_overcloud_profiles_list_control_flavor`: (Deprecated in U) Nova flavor to use for control nodes.
|
||||
* `tripleo_overcloud_profiles_list_compute_flavor`: (Deprecated in U) Nova flavor to use for compute nodes.
|
||||
* `tripleo_overcloud_profiles_list_ceph_storage_flavor`: (Deprecated in U) Nova flavor to use for ceph storage nodes.
|
||||
* `tripleo_overcloud_profiles_list_block_storage_flavor`: (Deprecated in U) Nova flavor to use for cinder storage nodes.
|
||||
* `tripleo_overcloud_profiles_list_swift_storage_flavor`: (Deprecated in U) Nova flavor to use for swift storage nodes.
|
||||
* `tripleo_overcloud_profiles_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_profiles_list_rc_file`.
|
||||
* `tripleo_overcloud_profiles_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_profiles_list_output`: (String) The command standard output.
|
||||
* `tripleo_overcloud_profiles_list_result`: Ansible shell execution results
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
None.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Example overcloud profiles list playbook
|
||||
|
||||
```yaml
|
||||
- hosts: undercloud
|
||||
gather_facts: true
|
||||
tasks:
|
||||
- name: List profiles
|
||||
import_role:
|
||||
name: tripleo_overcloud_profiles_list
|
||||
```
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Apache-2.0
|
||||
14
roles/tripleo_overcloud_profiles_list/defaults/main.yml
Normal file
14
roles/tripleo_overcloud_profiles_list/defaults/main.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
# defaults file for tripleo_overcloud_profiles_list
|
||||
openstack_bin: openstack
|
||||
tripleo_overcloud_profiles_list_all: false
|
||||
tripleo_overcloud_profiles_list_block_storage_flavor:
|
||||
tripleo_overcloud_profiles_list_ceph_storage_flavor:
|
||||
tripleo_overcloud_profiles_list_compute_flavor:
|
||||
tripleo_overcloud_profiles_list_control_flavor:
|
||||
tripleo_overcloud_profiles_list_debug: false
|
||||
tripleo_overcloud_profiles_list_generate_scripts: "{{ tripleo_generate_scripts | default(False) }}"
|
||||
tripleo_overcloud_profiles_list_home_dir: "{{ ansible_env.HOME }}"
|
||||
tripleo_overcloud_profiles_list_os_cloud: "{{ tripleo_os_cloud | default('') }}"
|
||||
tripleo_overcloud_profiles_list_rc_file: "{{ tripleo_rc_file | default(ansible_env.HOME ~ '/stackrc') }}"
|
||||
tripleo_overcloud_profiles_list_swift_storage_flavor:
|
||||
42
roles/tripleo_overcloud_profiles_list/meta/main.yml
Normal file
42
roles/tripleo_overcloud_profiles_list/meta/main.yml
Normal file
@@ -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_profiles_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,104 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
collections:
|
||||
- tripleo.operator
|
||||
vars:
|
||||
openstack_bin: echo
|
||||
tripleo_overcloud_profiles_list_debug: true
|
||||
tripleo_os_cloud: undercloud
|
||||
tasks:
|
||||
|
||||
- name: "Include tripleo_overcloud_profiles_list"
|
||||
include_role:
|
||||
name: "tripleo_overcloud_profiles_list"
|
||||
|
||||
- name: Check role
|
||||
assert:
|
||||
that:
|
||||
- tripleo_overcloud_profiles_list_output == "overcloud profiles list"
|
||||
|
||||
- name: Check parameter "tripleo_overcloud_profiles_list_all"
|
||||
include_role:
|
||||
name: "tripleo_overcloud_profiles_list"
|
||||
vars:
|
||||
tripleo_overcloud_profiles_list_all: true
|
||||
|
||||
- name: Assert "tripleo_overcloud_profiles_list_all"
|
||||
assert:
|
||||
that:
|
||||
- tripleo_overcloud_profiles_list_output == "overcloud profiles list --all"
|
||||
|
||||
- name: Check parameter "tripleo_overcloud_profiles_list_control_flavor"
|
||||
include_role:
|
||||
name: "tripleo_overcloud_profiles_list"
|
||||
vars:
|
||||
tripleo_overcloud_profiles_list_control_flavor: value
|
||||
|
||||
- name: Assert "tripleo_overcloud_profiles_list_control_flavor"
|
||||
assert:
|
||||
that:
|
||||
- tripleo_overcloud_profiles_list_output == "overcloud profiles list --control-flavor value"
|
||||
|
||||
- name: Check parameter "tripleo_overcloud_profiles_list_compute_flavor"
|
||||
include_role:
|
||||
name: "tripleo_overcloud_profiles_list"
|
||||
vars:
|
||||
tripleo_overcloud_profiles_list_compute_flavor: value
|
||||
|
||||
- name: Assert "tripleo_overcloud_profiles_list_compute_flavor"
|
||||
assert:
|
||||
that:
|
||||
- tripleo_overcloud_profiles_list_output == "overcloud profiles list --compute-flavor value"
|
||||
|
||||
- name: Check parameter "tripleo_overcloud_profiles_list_ceph_storage_flavor"
|
||||
include_role:
|
||||
name: "tripleo_overcloud_profiles_list"
|
||||
vars:
|
||||
tripleo_overcloud_profiles_list_ceph_storage_flavor: value
|
||||
|
||||
- name: Assert "tripleo_overcloud_profiles_list_ceph_storage_flavor"
|
||||
assert:
|
||||
that:
|
||||
- tripleo_overcloud_profiles_list_output == "overcloud profiles list --ceph-storage-flavor value"
|
||||
|
||||
- name: Check parameter "tripleo_overcloud_profiles_list_block_storage_flavor"
|
||||
include_role:
|
||||
name: "tripleo_overcloud_profiles_list"
|
||||
vars:
|
||||
tripleo_overcloud_profiles_list_block_storage_flavor: value
|
||||
|
||||
- name: Assert "tripleo_overcloud_profiles_list_block_storage_flavor"
|
||||
assert:
|
||||
that:
|
||||
- tripleo_overcloud_profiles_list_output == "overcloud profiles list --block-storage-flavor value"
|
||||
|
||||
- name: Check parameter "tripleo_overcloud_profiles_list_swift_storage_flavor"
|
||||
include_role:
|
||||
name: "tripleo_overcloud_profiles_list"
|
||||
vars:
|
||||
tripleo_overcloud_profiles_list_swift_storage_flavor: value
|
||||
|
||||
- name: Assert "tripleo_overcloud_profiles_list_swift_storage_flavor"
|
||||
assert:
|
||||
that:
|
||||
- tripleo_overcloud_profiles_list_output == "overcloud profiles list --swift-storage-flavor value"
|
||||
|
||||
|
||||
- name: Check all parameters for role tripleo_overcloud_profiles_list
|
||||
include_role:
|
||||
name: "tripleo_overcloud_profiles_list"
|
||||
vars:
|
||||
tripleo_overcloud_profiles_list_all: true
|
||||
tripleo_overcloud_profiles_list_control_flavor: value
|
||||
tripleo_overcloud_profiles_list_compute_flavor: value
|
||||
tripleo_overcloud_profiles_list_ceph_storage_flavor: value
|
||||
tripleo_overcloud_profiles_list_block_storage_flavor: value
|
||||
tripleo_overcloud_profiles_list_swift_storage_flavor: value
|
||||
|
||||
- name: Assert all parameters for role tripleo_overcloud_profiles_list
|
||||
assert:
|
||||
that:
|
||||
- tripleo_overcloud_profiles_list_output ==
|
||||
"overcloud profiles list --all --control-flavor value --compute-flavor value --ceph-storage-flavor value
|
||||
--block-storage-flavor value --swift-storage-flavor 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
|
||||
43
roles/tripleo_overcloud_profiles_list/tasks/main.yml
Normal file
43
roles/tripleo_overcloud_profiles_list/tasks/main.yml
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
# tasks file for tripleo_overcloud_profiles_list
|
||||
- name: Setup overcloud profiles list command
|
||||
set_fact:
|
||||
_list_cmd: >-
|
||||
{{ tripleo_overcloud_profiles_list_os_cloud | ternary('', "source " ~ tripleo_overcloud_profiles_list_rc_file ~ "; ") }}
|
||||
{{ openstack_bin }} overcloud profiles list
|
||||
{{ tripleo_overcloud_profiles_list_all | ternary('--all', '') }}
|
||||
{{ tripleo_overcloud_profiles_list_control_flavor | ternary('--control-flavor ' ~ tripleo_overcloud_profiles_list_control_flavor, '') }}
|
||||
{{ tripleo_overcloud_profiles_list_compute_flavor | ternary('--compute-flavor ' ~ tripleo_overcloud_profiles_list_compute_flavor, '') }}
|
||||
{{ tripleo_overcloud_profiles_list_ceph_storage_flavor | ternary('--ceph-storage-flavor ' ~ tripleo_overcloud_profiles_list_ceph_storage_flavor, '') }}
|
||||
{{ tripleo_overcloud_profiles_list_block_storage_flavor | ternary('--block-storage-flavor ' ~ tripleo_overcloud_profiles_list_block_storage_flavor, '') }}
|
||||
{{ tripleo_overcloud_profiles_list_swift_storage_flavor | ternary('--swift-storage-flavor ' ~ tripleo_overcloud_profiles_list_swift_storage_flavor, '') }}
|
||||
_list_env:
|
||||
OS_CLOUD: "{{ tripleo_overcloud_profiles_list_os_cloud }}"
|
||||
|
||||
- name: Show debug information
|
||||
when: tripleo_overcloud_profiles_list_debug|bool
|
||||
block:
|
||||
- name: Show the profiles list command
|
||||
debug:
|
||||
var: _list_cmd
|
||||
|
||||
- name: Show the profiles list environment
|
||||
debug:
|
||||
var: _list_env
|
||||
|
||||
- name: Write reproducer script
|
||||
tripleo_shell_script:
|
||||
dest: "{{ tripleo_overcloud_profiles_list_home_dir }}/tripleo_overcloud_profiles_list.sh"
|
||||
shell_command: "{{ _list_cmd }}"
|
||||
shell_environment: "{{ _list_env }}"
|
||||
when: tripleo_overcloud_profiles_list_generate_scripts|bool
|
||||
|
||||
- name: List profiles
|
||||
shell: "{{ _list_cmd }}" # noqa 305
|
||||
environment: "{{ _list_env }}"
|
||||
register: tripleo_overcloud_profiles_list_result
|
||||
changed_when: true
|
||||
|
||||
- name: Set output fact
|
||||
set_fact:
|
||||
tripleo_overcloud_profiles_list_output: "{{ tripleo_overcloud_profiles_list_result.stdout }}"
|
||||
1
roles/tripleo_overcloud_profiles_list/tests/inventory
Normal file
1
roles/tripleo_overcloud_profiles_list/tests/inventory
Normal file
@@ -0,0 +1 @@
|
||||
localhost
|
||||
4
roles/tripleo_overcloud_profiles_list/tests/test.yml
Normal file
4
roles/tripleo_overcloud_profiles_list/tests/test.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
roles:
|
||||
- tripleo_overcloud_profiles_list
|
||||
@@ -43,6 +43,7 @@
|
||||
- tripleo-operator-molecule-tripleo_overcloud_node_provide
|
||||
- tripleo-operator-molecule-tripleo_overcloud_node_provision
|
||||
- tripleo-operator-molecule-tripleo_overcloud_node_unprovision
|
||||
- tripleo-operator-molecule-tripleo_overcloud_profiles_list
|
||||
- tripleo-operator-molecule-tripleo_overcloud_raid_create
|
||||
- tripleo-operator-molecule-tripleo_overcloud_roles_list
|
||||
- tripleo-operator-molecule-tripleo_overcloud_roles_show
|
||||
@@ -102,6 +103,7 @@
|
||||
- tripleo-operator-molecule-tripleo_overcloud_node_provide
|
||||
- tripleo-operator-molecule-tripleo_overcloud_node_provision
|
||||
- tripleo-operator-molecule-tripleo_overcloud_node_unprovision
|
||||
- tripleo-operator-molecule-tripleo_overcloud_profiles_list
|
||||
- tripleo-operator-molecule-tripleo_overcloud_raid_create
|
||||
- tripleo-operator-molecule-tripleo_overcloud_roles_list
|
||||
- tripleo-operator-molecule-tripleo_overcloud_roles_show
|
||||
@@ -599,6 +601,20 @@
|
||||
vars:
|
||||
tox_extra_args: tripleo_overcloud_node_unprovision
|
||||
|
||||
- job:
|
||||
files:
|
||||
- ^roles/tripleo_overcloud_profiles_list/.*
|
||||
- ^bindep.txt
|
||||
- ^galaxy.yml
|
||||
- ^requirements.txt
|
||||
- ^setup.cfg
|
||||
- ^test-requirements.txt
|
||||
- ^tox.ini
|
||||
name: tripleo-operator-molecule-tripleo_overcloud_profiles_list
|
||||
parent: tripleo-operator-molecule-base
|
||||
vars:
|
||||
tox_extra_args: tripleo_overcloud_profiles_list
|
||||
|
||||
- job:
|
||||
files:
|
||||
- ^roles/tripleo_overcloud_raid_create/.*
|
||||
|
||||
Reference in New Issue
Block a user