Files
tripleo-operator-ansible/roles/tripleo_container_image_show/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

37 lines
1.4 KiB
YAML

---
# tasks file for tripleo_container_image_show
- name: Setup container image show facts
set_fact:
_show_cmd: >-
{{ openstack_bin }} tripleo container image show
{{ tripleo_container_image_show_username | ternary('--username "$TRIPLEO_IMAGE_SHOW_USERNAME"', '') }}
{{ tripleo_container_image_show_password | ternary('--password "$TRIPLEO_IMAGE_SHOW_PASSWORD"', '') }}
{{ tripleo_container_image_show_format | ternary('-f $TRIPLEO_IMAGE_SHOW_FORMAT', '') }}
{{ tripleo_container_image_show_image }}
_show_env:
TRIPLEO_IMAGE_SHOW_USERNAME: "{{ tripleo_container_image_show_username | default('') | quote }}"
TRIPLEO_IMAGE_SHOW_PASSWORD: "{{ tripleo_container_image_show_password | default('') | quote }}"
TRIPLEO_IMAGE_SHOW_FORMAT: "{{ tripleo_container_image_show_format | default('') }}"
- name: Show debug information
when: tripleo_container_image_show_debug|bool
block:
- name: Show the container image show command
debug:
var: _show_cmd
- name: Show the container image show environment
debug:
var: _show_env
- name: Container image show
shell: "{{ _show_cmd }}" # noqa 305
environment: "{{ _show_env }}"
register: tripleo_container_image_show_result
changed_when: false
- name: Set output fact
when:
- tripleo_container_image_show_result.stdout is defined
set_fact:
tripleo_container_image_show_output: "{{ tripleo_container_image_show_result.stdout }}"