Files
tripleo-operator-ansible/roles/tripleo_overcloud_status/tasks/main.yml
Cédric Jeanneret 7ae7c668ed Ensure we export result only if we have an stdout
I841743fb6c2c24e4a3d86598f99322022b27804d introduced a sort of "dry-run"
capability to the operators, but it didn't take care of the possible
exposure of the shell stdout in a fact. Thus, if you enabled the
generate_scripts_only feature, your ansible run would fail on the
exposure, since the variable it refers to will not exist.

Change-Id: I07225e6b82199cf15860e55db6995c994da65931
2020-05-15 15:43:20 +02:00

34 lines
1.0 KiB
YAML

---
# 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, '') }}
_status_env:
OS_CLOUD: "{{ tripleo_overcloud_status_os_cloud }}"
- name: Show debug information
when: tripleo_overcloud_status_debug|bool
block:
- name: Show the overcloud status command
debug:
var: _status_cmd
- name: Show the overcloud status environment
debug:
var: _status_env
- name: Overcloud status
shell: "{{ _status_cmd }}" # noqa 305
environment: "{{ _status_env }}"
register: tripleo_overcloud_status_result
changed_when: false
- name: Set output fact
when:
- tripleo_overcloud_status_result.stdout is defined
set_fact:
tripleo_overcloud_status_output: "{{ tripleo_overcloud_status_result.stdout }}"