forked from redhat-cop/agnosticd
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdestroy_env.yml
55 lines (49 loc) · 1.49 KB
/
destroy_env.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
- 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_vars | default( {} ),
config_ocp_workloads_secrets | 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