Files
tripleo-operator-ansible/roles/tripleo_overcloud_netenv_validate/tasks/main.yml
Alex Schultz d2b23da366 Add ability to write scripts
Add the ability to write out the command being exected to a script for
the roles that aren't single action list/show/remove/etc as they would
not be something to rerun and are really for ansible-only control.

Change-Id: I11ad3c12de21fe0522d13f966783cb413b661646
2020-04-15 16:25:27 -06:00

53 lines
1.8 KiB
YAML

---
# tasks file for tripleo_overcloud_netenv_validate
- name: Set overcloud netenv validate facts
set_fact:
_validate_cmd: >-
{{ openstack_bin }} overcloud netenv validate
{{ tripleo_overcloud_netenv_validate_file | ternary('--file $NETENV_FILE', '') }}
{{ tripleo_overcloud_netenv_validate_log_output | ternary((">" ~ tripleo_overcloud_netenv_validate_log), '') }}
{{ tripleo_overcloud_netenv_validate_log_combine | ternary("2>&1", '') }}
_validate_env:
NETENV_FILE: "{{ tripleo_overcloud_netenv_validate_file | quote }}"
- name: Preserve existing log file if exists
timestamp_file:
path: "{{ tripleo_overcloud_netenv_validate_log }}"
when: tripleo_overcloud_netenv_validate_log_output|bool
- name: Show debug information
when: tripleo_overcloud_netenv_validate_debug|bool
block:
- name: Show the command
debug:
var: _validate_cmd
- name: Show the environment
debug:
var: _validate_env
- name: Write reproducer script
tripleo_shell_script:
dest: "{{ tripleo_overcloud_netenv_validate_home_dir }}/tripleo_overcloud_netenv_validate.sh"
shell_command: "{{ _validate_cmd }}"
shell_environment: "{{ _validate_env }}"
when: tripleo_overcloud_netenv_validate_generate_scripts|bool
- name: Run overcloud netenv validate
shell: "{{ _validate_cmd }}" # noqa 305
environment: "{{ _validate_env }}"
args:
executable: /bin/bash
chdir: "{{ tripleo_overcloud_netenv_validate_home_dir }}"
warn: false
register: tripleo_overcloud_netenv_validate_result
async: "{{ tripleo_overcloud_netenv_validate_timeout }}"
poll: "{{ tripleo_overcloud_netenv_validate_poll }}"
changed_when: false
when: not ansible_check_mode|bool
- name: Set output fact
set_fact:
tripleo_overcloud_netenv_validate_output: "{{ tripleo_overcloud_netenv_validate_result.stdout }}"