4 # shellcheck disable=SC1091
6 # shellcheck disable=SC1091
9 BMO_RUN_LOCAL="${BMO_RUN_LOCAL:-false}"
10 CAPBM_RUN_LOCAL="${CAPBM_RUN_LOCAL:-false}"
12 # Kill and remove the running ironic containers
13 for name in ironic ironic-inspector dnsmasq httpd mariadb ipa-downloader; do
14 sudo "${CONTAINER_RUNTIME}" ps | grep -w "$name$" && sudo "${CONTAINER_RUNTIME}" kill $name
15 sudo "${CONTAINER_RUNTIME}" ps --all | grep -w "$name$" && sudo "${CONTAINER_RUNTIME}" rm $name -f
19 if [[ "${CONTAINER_RUNTIME}" == "podman" ]]; then
20 if sudo "${CONTAINER_RUNTIME}" pod exists ironic-pod ; then
21 sudo "${CONTAINER_RUNTIME}" pod rm ironic-pod -f
25 # Kill the locally running operators
26 if [ "${BMO_RUN_LOCAL}" = true ]; then
27 kill "$(pgrep "operator-sdk")" 2> /dev/null || true
29 if [ "${CAPBM_RUN_LOCAL}" = true ]; then
30 CAPBM_PARENT_PID="$(pgrep -f "go run ./cmd/manager/main.go")"
31 if [[ "${CAPBM_PARENT_PID}" != "" ]]; then
32 CAPBM_GO_PID="$(pgrep -P "${CAPBM_PARENT_PID}" )"
33 kill "${CAPBM_GO_PID}" 2> /dev/null || true
38 ANSIBLE_FORCE_COLOR=true ansible-playbook \
39 -e "working_dir=$WORKING_DIR" \
40 -e "num_masters=$NUM_MASTERS" \
41 -e "num_workers=$NUM_WORKERS" \
42 -e "extradisks=$VM_EXTRADISKS" \
43 -e "virthost=$HOSTNAME" \
44 -e "manage_baremetal=$MANAGE_BR_BRIDGE" \
45 -i vm-setup/inventory.ini \
46 -b -vvv vm-setup/teardown-playbook.yml
48 sudo rm -rf /etc/NetworkManager/conf.d/dnsmasq.conf
49 # There was a bug in this file, it may need to be recreated.
50 if [ "$MANAGE_PRO_BRIDGE" == "y" ]; then
51 sudo ifdown provisioning || true
52 sudo rm -f /etc/sysconfig/network-scripts/ifcfg-provisioning || true
54 # Leaving this around causes issues when the host is rebooted
55 if [ "$MANAGE_BR_BRIDGE" == "y" ]; then
56 sudo ifdown baremetal || true
57 sudo rm -f /etc/sysconfig/network-scripts/ifcfg-baremetal || true
61 rm -rf $IRONIC_DATA_DIR