From d1b29e2e20c998c75e205d973d8ae662307720d7 Mon Sep 17 00:00:00 2001 From: chrisjsimpson Date: Sat, 9 Nov 2024 18:05:09 +0000 Subject: [PATCH] #13 wip add bootstap-server.sh helper script --- src/bootstap-server.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 src/bootstap-server.sh diff --git a/src/bootstap-server.sh b/src/bootstap-server.sh new file mode 100755 index 0000000..8e6fcb9 --- /dev/null +++ b/src/bootstap-server.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +set -euo pipefail + +. ../venv/bin/activate + +set -x + +# Required environment settings +# - IDRAC_HOST +# - IDRAC_USERNAME +# - IDRAC_PASSWORD + + +# Check for required environment variables +REQUIRED_VARS=("IDRAC_HOST" "IDRAC_USERNAME" "IDRAC_PASSWORD" "HOST_HEALTHCHECK_POLL_IP") +for var in "${REQUIRED_VARS[@]}"; do + if [ -z "${!var:-}" ]; then + echo "Error: Required environment variable $var is not set." + exit 1 + fi +done + +cd web-ui + +# Get server to a netbooted state (alpine) +python3 -c "from app import execute_redfish_command; execute_redfish_command('Bootstrap')" + +# Run playbook to install fedora +ansible-playbook -i src/inventory.yaml src/playbooks/servers.yaml +