-
Notifications
You must be signed in to change notification settings - Fork 13
/
uninstall-private.yml
79 lines (70 loc) · 2.2 KB
/
uninstall-private.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
- name: "[AZURE-PRIVATE] Destroy Azure Openshift Cluster in Private Mode"
hosts: localhost
gather_facts: yes
vars:
vars_files_list:
- vault/azure.yml
- vars/vars-private.yml
tasks:
- name: Include vars_files
include_vars: "{{ item }}"
when: item is file
loop: "{{ vars_files_list }}"
- name: Get facts for one Public IP
azure_rm_publicipaddress_info:
resource_group: "{{ azure_resource_group }}"
name: "{{ azure_vm_name }}01"
register: output
- debug:
msg: "{{ output.publicipaddresses.0.ip_address }}"
- name: Get IP
set_fact:
azure_vm_public_ip: "{{ output.publicipaddresses.0.ip_address }}"
- name: Handle private keys check
include_tasks: roles/ocp4-cloud-ipi/tasks/handle-prereqs.yml
when: private_ssh_key is defined
- name: Add azure vm into host
add_host:
name: bastion
groups: "inv"
ansible_host: '{{ azure_vm_public_ip }}'
ansible_connection: ssh
ansible_user: "{{ azure_vm_admin_username }}"
ansible_ssh_private_key_file: "{{ azure_vm_admin_key_path }}"
become: true
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
#changed_when: false
- name: Check the ssh connection
wait_for:
port: 22
host: '{{ azure_vm_public_ip }}'
timeout: 600
- name: "[AZURE-PRIVATE] Delete Azure Openshift Cluster"
hosts: inv
become: true
vars:
vars_files_list:
- vault/azure.yml
- vars/vars-private.yml
tasks:
- name: Include vars_files
include_vars: "{{ item }}"
when: item is file
loop: "{{ vars_files_list }}"
- name: Delete the Openshift Cluster
include_tasks: roles/ocp4-cloud-ipi/tasks/uninstall.yml
- name: "[AZURE-PRIVATE] Destroy Azure Openshift Cluster in Private Mode"
hosts: localhost
gather_facts: yes
vars:
vars_files_list:
- vault/azure.yml
- vars/vars-private.yml
tasks:
- name: Include vars_files
include_vars: "{{ item }}"
when: item is file
loop: "{{ vars_files_list }}"
- name: Destroy Resource Group of Openshift
include_tasks: roles/ocp4-cloud-ipi/tasks/azure-infra-destroy.yml