forked from redhat-cop/agnosticd
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdestroy_env_gcp.yml
61 lines (51 loc) · 1.63 KB
/
destroy_env_gcp.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
56
57
58
59
60
61
---
- import_playbook: ../../setup_runtime.yml
- name: Set up environment for destroy
hosts: localhost
connection: local
become: false
tasks:
- name: Create GCP credentials file
include_role:
name: infra-gcp-credentials-file
- name: Get Google Cloud SDK
include_role:
name: infra-gcp-install-sdk
- name: Get private SSH key from secrets
include_role:
name: infra-gcp-ssh-key
- name: Run infra-gcp-create-inventory role
include_role:
name: infra-gcp-create-inventory
- name: SSH config setup
when:
- groups["bastions"] is defined
- groups["bastions"] | length > 0
include_role:
name: infra-common-ssh-config-generate
- name: Set ssh extra args for all hosts, use ssh_config just created
hosts: all
gather_facts: false
any_errors_fatal: true
ignore_errors: false
tasks:
- name: add -F option ansible_ssh_extra_args
set_fact:
ansible_ssh_extra_args: "{{ ansible_ssh_extra_args|d() }} -F {{ hostvars['localhost'].ansible_ssh_config }}"
# TBD: Add start VM logic for GCP when the environment supports stop/start
- name: Have the OpenShift installer cleanup what it did
hosts: bastions
gather_facts: false
become: false
tasks:
- name: Test the bastion host is available, if not skip host-ocp4-destroy
wait_for_connection:
timeout: 60
register: bwait
ignore_errors: true
- name: Call role to destroy the OpenShift cluster
when: bwait is successful
include_role:
name: host-ocp4-destroy
- name: Import default cloud provider destroy playbook
import_playbook: "../../cloud_providers/{{ cloud_provider }}_destroy_env.yml"