---
|
- import_playbook: ../../setup_runtime.yml
|
|
# Build inventory
|
- import_playbook: post_infra.yml
|
|
- name: Destroy workload(s)
|
hosts: ocp_bastions
|
become: false
|
gather_facts: false
|
tags:
|
- step005
|
tasks:
|
- name: Set up combined ocp_workloads dictionary
|
set_fact:
|
config_ocp_workloads: >-
|
{{ config_ocp_workloads_defaults
|
| combine( config_ocp_workloads_input | default( {} ),
|
config_ocp_workloads_secret | default( {} ), recursive=true)
|
}}
|
- name: Print combined role variables
|
debug:
|
var: config_ocp_workloads
|
verbosity: 2
|
|
- name: Check if desired virtualenv is available on the host
|
stat:
|
path: "{{ config_ocp_workloads.virtualenv_path}}/bin/python"
|
register: r_virtualenv
|
- name: Set Ansible Python interpreter to virtualenv
|
when: r_virtualenv.stat.exists
|
set_fact:
|
ansible_python_interpreter: "{{ config_ocp_workloads.virtualenv_path }}/bin/python"
|
|
- name: Run a single workload
|
when: ocp_workload is defined
|
include_role:
|
name: "{{ ocp_workload }}"
|
vars:
|
ACTION: destroy
|
|
- name: Run a list of workloads
|
when:
|
- ocp_workloads is defined
|
- ocp_workloads | length > 0
|
include_role:
|
name: "{{ _ocp_workload }}"
|
loop: "{{ ocp_workloads }}"
|
loop_control:
|
loop_var: _ocp_workload
|
vars:
|
ACTION: destroy
|
|
- name: Cleanup
|
import_playbook: cleanup.yml
|