Add overcloud status role

Adds tripleo_overcloud_status role that can be used to collect the
overcloud deployment status.

Change-Id: I79be50ce14648efdc2b1cbba56cba5c98cc2fc3a
This commit is contained in:
Alex Schultz
2020-01-21 15:08:41 -07:00
parent 110e58deb8
commit b379c66729
6 changed files with 127 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
tripleo_overcloud_status
==========================
A role to get the deployment status output.
Requirements
------------
None.
Role Variables
--------------
* `tripleo_overcloud_status_debug`: (Boolean) Flag to print out the command that is run. Default: False
* `tripleo_overcloud_status_os_cloud`: (String) (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_status_rc_file`.
* `tripleo_overcloud_status_plan`: (String) The name of the stakc/plan. Default: overcloud
* `tripleo_overcloud_status_rc_file`: (String) (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_status_output`: (String) The command standard output.
* `tripleo_overcloud_status_result`: Ansible shell execution results
Dependencies
------------
None.
Example Playbook
----------------
Example overcloud status execution playbook
```yaml
- hosts: undercloud
gather_facts: true
tasks:
- name: Get overcloud status
import_role:
name: tripleo_overcloud_status
```
License
-------
Apache-2.0

View File

@@ -0,0 +1,6 @@
---
# defaults file for tripleo_overcloud_status
tripleo_overcloud_status_debug: false
tripleo_overcloud_status_os_cloud: "{{ tripleo_os_cloud | default('') }}"
tripleo_overcloud_status_plan: overcloud
tripleo_overcloud_status_rc_file: "{{ tripleo_rc_file | default(ansible_env.HOME ~ '/stackrc') }}"

View 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_status
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: []

View File

@@ -0,0 +1,22 @@
---
# tasks file for tripleo_overcloud_status
- name: Setup overcloud status facts
set_fact:
_status_cmd: >-
{{ tripleo_overcloud_status_os_cloud | ternary('', "source " ~ tripleo_overcloud_status_rc_file ~ "; ") }}
openstack overcloud status
{{ tripleo_overcloud_status_plan | ternary('--plan ' ~ tripleo_overcloud_status_plan, '') }}
- name: Show the overcloud status command
debug:
var: _status_cmd
when: tripleo_overcloud_status_debug|bool
- name: Overcloud status
shell: "{{ _status_cmd }}" # noqa 305
register: tripleo_overcloud_status_result
changed_when: false
- name: Set output fact
set_fact:
tripleo_overcloud_status_output: "{{ tripleo_overcloud_status_result.stdout }}"

View File

@@ -0,0 +1 @@
localhost

View File

@@ -0,0 +1,4 @@
---
- hosts: localhost
roles:
- tripleo_overcloud_status