forked from openshift-metal3/dev-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhost_cleanup.sh
executable file
·70 lines (62 loc) · 2.52 KB
/
host_cleanup.sh
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
#!/usr/bin/env bash
set -x
source logging.sh
source common.sh
source utils.sh
if [ -z "${METAL3_DEV_ENV}" ]; then
export REPO_PATH=${WORKING_DIR}
sync_repo_and_patch metal3-dev-env https://github.com/metal3-io/metal3-dev-env.git
fi
export ANSIBLE_FORCE_COLOR=true
ansible-playbook \
-e @vm_setup_vars.yml \
-e "ironic_prefix=${CLUSTER_NAME}_" \
-e "cluster_name=${CLUSTER_NAME}" \
-e "provisioning_network_name=${PROVISIONING_NETWORK_NAME}" \
-e "baremetal_network_name=${BAREMETAL_NETWORK_NAME}" \
-e "working_dir=$WORKING_DIR" \
-e "num_masters=$NUM_MASTERS" \
-e "num_workers=$NUM_WORKERS" \
-e "extradisks=$VM_EXTRADISKS" \
-e "virthost=$HOSTNAME" \
-e "manage_baremetal=$MANAGE_BR_BRIDGE" \
-e "nodes_file=$NODES_FILE" \
-i ${VM_SETUP_PATH}/inventory.ini \
-b -vvv ${VM_SETUP_PATH}/teardown-playbook.yml
# Invoke the playbook a second time to remove any extra workers.
if [ ${NUM_EXTRA_WORKERS} -ne 0 ]; then
ansible-playbook \
-e @vm_setup_vars.yml \
-e "ironic_prefix=${CLUSTER_NAME}_extra_" \
-e "cluster_name=${CLUSTER_NAME}" \
-e "provisioning_network_name=${PROVISIONING_NETWORK_NAME}" \
-e "baremetal_network_name=${BAREMETAL_NETWORK_NAME}" \
-e "working_dir=$WORKING_DIR" \
-e "num_masters=$NUM_MASTERS" \
-e "num_workers=$NUM_EXTRA_WORKERS" \
-e "extradisks=$VM_EXTRADISKS" \
-e "virthost=$HOSTNAME" \
-e "manage_baremetal=$MANAGE_BR_BRIDGE" \
-e "nodes_file=$EXTRA_NODES_FILE" \
-i ${VM_SETUP_PATH}/inventory.ini \
-b -vvv ${VM_SETUP_PATH}/teardown-playbook.yml
fi
sudo rm -rf /etc/NetworkManager/dnsmasq.d/openshift-${CLUSTER_NAME}.conf /etc/yum.repos.d/delorean*
# There was a bug in this file, it may need to be recreated.
# delete the interface as it can cause issues when not rebooting
if [ "$MANAGE_PRO_BRIDGE" == "y" ]; then
sudo ifdown ${PROVISIONING_NETWORK_NAME} || true
sudo ip link delete ${PROVISIONING_NETWORK_NAME} || true
sudo rm -f /etc/sysconfig/network-scripts/ifcfg-${PROVISIONING_NETWORK_NAME}
fi
# Leaving this around causes issues when the host is rebooted
# delete the interface as it can cause issues when not rebooting
if [ "$MANAGE_BR_BRIDGE" == "y" ]; then
sudo ifdown ${BAREMETAL_NETWORK_NAME} || true
sudo ip link delete ${BAREMETAL_NETWORK_NAME} || true
sudo rm -f /etc/sysconfig/network-scripts/ifcfg-${BAREMETAL_NETWORK_NAME}
fi
# Drop all ebtables rules
sudo ebtables --flush
# Kill any lingering proxy
sudo pkill -f oc.*proxy