forked from IBM/Ansible-OpenShift-Provisioning
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdelete_compute_node.yaml
More file actions
53 lines (49 loc) · 1.98 KB
/
delete_compute_node.yaml
File metadata and controls
53 lines (49 loc) · 1.98 KB
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
---
###################################################################################################
# To execute this playbook you need to create a node config yaml fiile with these parameters:
# ---
# day2_compute_node:
# vm_name: <your VM name>
# vm_hostname: <your VM host name>
# vm_ip: <your VM IP address>
# vm_ipv6: <your VM IPv6 address>
# vm_mac: <your VM MAC address, when DHCP is used>
# vm_interface: <your VM network interface used for the IP addresses>
# hostname: <KVM host name where the VM is created>
# host_user: <KVM host user which is used to create the VM>
# host_arch: <KVM host architecture>
#
# Execute the playbook with '--extra-vars' option.
# E.g.:
# ansible-playbook playbooks/delete_compute_node.yaml --extra-vars "@extra-cnode1.yml"
- name: Delete compute node
hosts: bastion
gather_facts: false
vars_files:
- "{{ inventory_dir }}/group_vars/all.yaml"
pre_tasks:
- name: Check required variables
when: (day2_compute_node is not defined)
block:
- name: Check required variables
ansible.builtin.debug:
msg:
- "ERROR: Variable 'day2_compute_node' is not defined!"
- "Execute: 'ansible-playbook playbooks/delete_compute_node.yaml --extra-vars \"@extra-cnode.yml\"'"
- name: Abort playbook
ansible.builtin.fail:
msg: "See above error!"
roles:
- role: delete_compute_node
# Some tasks will be delegated to the bastion host and target KVM host
param_compute_node: "{{ day2_compute_node }}"
- role: haproxy_update
when: env.bastion.options.loadbalancer.on_bastion
param_haproxy_cmd: delete
param_haproxy_hostname: "{{ day2_compute_node.vm_hostname }}"
- role: dns_update
when: env.bastion.options.dns is defined and env.bastion.options.dns
param_dns_cmd: delete
param_dns_hostname: "{{ day2_compute_node.vm_hostname }}"
param_dns_ip: "{{ day2_compute_node.vm_ip }}"
- role: print_node_status