feat(awx): scaffold AWX deployment scripts and manifests
Create top-level awx/ directory with k3s install script, AWX operator +
instance deployment script, namespace manifest, and AWX custom resource
(LoadBalancer service type, bundled PostgreSQL on local-path).
Target: tsys-awx.knel.net (VMID 600 on pfv-tsys6, 4c/12GB/60GB disk).
💘 Generated with Crush
Assisted-by: Crush:glm-5.2
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env bash
|
||||
###############################################################################
|
||||
# deploy-awx.sh — Deploy AWX Operator + instance on k3s.
|
||||
#
|
||||
# Prerequisites: k3s must be installed and running (install-k3s.sh).
|
||||
# Intended to run ON the target VM (tsys-awx.knel.net) as root or via sudo.
|
||||
#
|
||||
# Usage: sudo bash deploy-awx.sh
|
||||
###############################################################################
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
export KUBECONFIG="${KUBECONFIG:-/etc/rancher/k3s/k3s.yaml}"
|
||||
|
||||
OPERATOR_VERSION="${OPERATOR_VERSION:-2.19.1}"
|
||||
|
||||
echo "=========================================================="
|
||||
echo " AWX Operator deployment — version ${OPERATOR_VERSION}"
|
||||
echo "=========================================================="
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Step 1: Create namespace
|
||||
# ---------------------------------------------------------------------------
|
||||
echo ""
|
||||
echo "=== Step 1: Create namespace ==="
|
||||
kubectl apply -f "${SCRIPT_DIR}/namespace.yaml"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Step 2: Deploy AWX Operator
|
||||
# ---------------------------------------------------------------------------
|
||||
echo ""
|
||||
echo "=== Step 2: Deploy AWX Operator ${OPERATOR_VERSION} ==="
|
||||
|
||||
# Clone the operator to get kustomize manifests
|
||||
OPERATOR_DIR="/tmp/awx-operator-${OPERATOR_VERSION}"
|
||||
rm -rf "${OPERATOR_DIR}"
|
||||
git clone --branch "${OPERATOR_VERSION}" --depth 1 \
|
||||
"https://github.com/ansible/awx-operator.git" "${OPERATOR_DIR}" 2>&1 | tail -3
|
||||
|
||||
# The operator's default namespace is 'awx' — matches our setup
|
||||
# Apply the operator via kustomize
|
||||
kubectl apply -k "${OPERATOR_DIR}" 2>&1 || {
|
||||
echo "kustomize apply failed, trying raw manifests..."
|
||||
kubectl apply -f "https://raw.githubusercontent.com/ansible/awx-operator/${OPERATOR_VERSION}/deploy/awx-operator.yaml"
|
||||
}
|
||||
|
||||
echo ""
|
||||
echo "Waiting for AWX Operator deployment to be ready..."
|
||||
kubectl -n awx wait --for=condition=Available deployment/awx-operator-controller-manager \
|
||||
--timeout=300s 2>&1 || {
|
||||
echo "Operator not ready yet — checking status..."
|
||||
kubectl -n awx get pods
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Step 3: Deploy AWX instance
|
||||
# ---------------------------------------------------------------------------
|
||||
echo ""
|
||||
echo "=== Step 3: Deploy AWX instance ==="
|
||||
kubectl apply -f "${SCRIPT_DIR}/awx-instance.yaml"
|
||||
|
||||
echo ""
|
||||
echo "AWX instance created. Operator will now reconcile."
|
||||
echo "This typically takes 5-10 minutes for the first deployment."
|
||||
echo ""
|
||||
echo "Monitor progress with:"
|
||||
echo " kubectl -n awx get awx tsys-awx -o jsonpath='{.status.conditions}' | jq ."
|
||||
echo " kubectl -n awx get pods -w"
|
||||
echo " kubectl -n awx logs deployment/awx-operator-controller-manager -f"
|
||||
Reference in New Issue
Block a user