-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathdeploy-fencing-ipi.sh
More file actions
executable file
·51 lines (43 loc) · 1.82 KB
/
deploy-fencing-ipi.sh
File metadata and controls
executable file
·51 lines (43 loc) · 1.82 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
#!/bin/bash
# Get the directory where this script is located
SCRIPT_DIR=$(dirname "$0")
# Get the deploy directory (two levels up from scripts)
DEPLOY_DIR="$(cd "${SCRIPT_DIR}/../.." && pwd)"
set -o nounset
set -o errexit
set -o pipefail
# shellcheck source=/dev/null
source "${DEPLOY_DIR}/aws-hypervisor/instance.env"
# Check if instance data exists
if [[ ! -f "${DEPLOY_DIR}/aws-hypervisor/${SHARED_DIR}/aws-instance-id" ]]; then
echo "Error: No instance found. Please run 'make deploy' first."
exit 1
fi
echo "Deploying fencing IPI cluster..."
# Check if inventory.ini exists in the openshift-clusters directory
if [[ ! -f "${DEPLOY_DIR}/openshift-clusters/inventory.ini" ]]; then
echo "Error: inventory.ini not found in ${DEPLOY_DIR}/openshift-clusters/"
echo "Please ensure the inventory file is properly configured."
echo "You can run 'make inventory' to update it with current instance information."
exit 1
fi
# Navigate to the openshift-clusters directory and run the setup playbook
echo "Running Ansible setup playbook with fencing topology in non-interactive mode..."
cd "${DEPLOY_DIR}/openshift-clusters"
# Run the setup playbook with fencing topology and non-interactive mode
if ansible-playbook setup.yml -e "topology=fencing" -e "interactive_mode=false" -i inventory.ini;
then
echo ""
echo "✓ OpenShift fencing cluster deployment completed successfully!"
echo ""
echo "Next steps:"
echo "1. Source the proxy environment from anywhere:"
echo " source ${DEPLOY_DIR}/openshift-clusters/proxy.env"
echo " (or from openshift-clusters directory: source proxy.env)"
echo "2. Verify cluster access: oc get nodes"
echo "3. Access the cluster console if needed"
else
echo "Error: OpenShift cluster deployment failed!"
echo "Check the Ansible logs for more details."
exit 1
fi