🤖 AWX Ansible Automation on AlmaLinux: Enterprise Automation Made Free
Welcome to enterprise-grade automation without the price tag! 🎉 Ready to automate everything with a beautiful web interface? AWX is the open-source upstream of Red Hat Ansible Tower, bringing powerful automation to everyone! It’s the platform that makes Ansible playbooks visual, scheduled, and collaborative! Think of it as your automation command center with all the enterprise features for free! 🚀✨
🤔 Why is AWX Important?
AWX transforms Ansible from CLI to enterprise platform! 🚀 Here’s why it’s amazing:
- 🎯 Web-Based UI - Manage Ansible visually!
- 📚 Playbook Management - Version control integration!
- 👥 Role-Based Access - Team collaboration made easy!
- 📅 Job Scheduling - Automate on schedule!
- 📊 Real-Time Output - Watch automation live!
- 🔌 REST API - Integrate with everything!
It’s like having Ansible Tower without the license fees! 💰
🎯 What You Need
Before building your automation empire, ensure you have:
- ✅ AlmaLinux 9 server
- ✅ Root or sudo access
- ✅ At least 4GB RAM (8GB recommended)
- ✅ 4 CPU cores minimum
- ✅ 20GB free disk space
- ✅ Kubernetes or Docker/Podman
- ✅ Love for automation! 🤖
📝 Step 1: System Preparation - Building the Foundation!
Let’s prepare AlmaLinux 9 for AWX! 🏗️
# Update system
sudo dnf update -y
# Install required packages
sudo dnf install -y git curl wget ansible-core python3-pip
# Install container runtime (Podman recommended for AlmaLinux)
sudo dnf install -y podman podman-compose
# Verify Podman
podman --version
# Should show: podman version 4.x.x
# Enable lingering for rootless containers
sudo loginctl enable-linger $USER
# Install K3s (lightweight Kubernetes)
curl -sfL https://get.k3s.io | sh -
# Check K3s status
sudo systemctl status k3s
# Should be active and running
# Get kubeconfig
sudo cat /etc/rancher/k3s/k3s.yaml > ~/.kube/config
sudo chown $USER:$USER ~/.kube/config
Configure firewall for AWX:
# Open required ports
sudo firewall-cmd --permanent --add-port=80/tcp # HTTP
sudo firewall-cmd --permanent --add-port=443/tcp # HTTPS
sudo firewall-cmd --permanent --add-port=8052/tcp # AWX receptor
sudo firewall-cmd --reload
# Verify ports
sudo firewall-cmd --list-ports
Perfect! System is ready! 🎯
🔧 Step 2: Installing AWX Operator - The Modern Way!
AWX now uses Kubernetes operator for deployment! 🚀
# Install AWX Operator
cd ~
git clone https://github.com/ansible/awx-operator.git
cd awx-operator
# Check out latest stable version
git checkout tags/2.7.0 # Check for latest version
# Deploy AWX Operator
export NAMESPACE=awx
kubectl create namespace ${NAMESPACE}
kubectl config set-context --current --namespace=${NAMESPACE}
# Install the operator
make deploy
# Verify operator is running
kubectl get pods
# Should show awx-operator pod running
Create AWX Instance:
# Create AWX deployment file
cat << EOF > awx-demo.yaml
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
name: awx-demo
spec:
service_type: nodeport
nodeport_port: 30080
# Admin account configuration
admin_user: admin
admin_password_secret: awx-admin-password
# Projects persistence
projects_persistence: true
projects_storage_size: 8Gi
# PostgreSQL configuration
postgres_storage_class: local-path
postgres_storage_requirements:
requests:
storage: 8Gi
# Resource requirements
web_resource_requirements:
requests:
cpu: 1000m
memory: 2Gi
task_resource_requirements:
requests:
cpu: 500m
memory: 1Gi
EOF
# Create admin password secret
cat << EOF > awx-admin-password.yaml
apiVersion: v1
kind: Secret
metadata:
name: awx-admin-password
namespace: awx
stringData:
password: Admin123!
EOF
# Apply configurations
kubectl apply -f awx-admin-password.yaml
kubectl apply -f awx-demo.yaml
# Watch deployment progress
kubectl logs -f deployments/awx-operator-controller-manager -c awx-manager
# This takes 10-15 minutes!
🌟 Step 3: Accessing AWX - Your Automation Dashboard!
Once deployment completes, access AWX! 🎮
Get Access Information:
# Check if AWX is ready
kubectl get pods
# All pods should be Running
# Get service information
kubectl get svc
# Note the NodePort for awx-demo-service
# Get admin password (if you forgot)
kubectl get secret awx-admin-password -o jsonpath="{.data.password}" | base64 --decode
# Access AWX
# URL: http://your-server-ip:30080
# Username: admin
# Password: Admin123!
First Login Setup:
- Open browser to
http://your-server-ip:30080
- Login with admin credentials
- Accept license agreement
- You’re in AWX dashboard! 🎉
Dashboard shows:
- 📊 Job Status - Recent job runs
- 🏢 Organizations - Tenant management
- 📚 Projects - Playbook repositories
- 📋 Inventories - Managed hosts
- 🎯 Job Templates - Automation blueprints
✅ Step 4: Setting Up Your First Project - Let’s Automate!
Time to create your first automation! 🎯
Create Organization:
- Click “Organizations” → “Add”
- Fill in:
- Name:
MyCompany
- Description:
My Company Automation
- Name:
- Save
Add Credentials:
- Click “Credentials” → “Add”
- Configure:
- Name:
Linux Servers
- Organization:
MyCompany
- Credential Type:
Machine
- Username:
ansible
- Password:
YourPassword
- SSH Private Key: (paste if using keys)
- Name:
- Save
Create Project:
- Click “Projects” → “Add”
- Configure:
- Name:
Demo Playbooks
- Organization:
MyCompany
- SCM Type:
Git
- SCM URL:
https://github.com/ansible/ansible-examples.git
- SCM Update Options: ✓ Clean, ✓ Update on Launch
- Name:
- Save and wait for sync
Create Inventory:
- Click “Inventories” → “Add” → “Inventory”
- Configure:
- Name:
Production Servers
- Organization:
MyCompany
- Name:
- Save
- Add Hosts:
- Click “Hosts” → “Add”
- Name:
web01.example.com
- Variables:
ansible_host: 192.168.1.10 ansible_user: ansible
- Save
🌟 Step 5: Creating Job Templates - Automation Blueprints!
Let’s create reusable automation! 🎯
Create Job Template:
- Click “Templates” → “Add” → “Job Template”
- Configure:
- Name:
Install Apache
- Job Type:
Run
- Inventory:
Production Servers
- Project:
Demo Playbooks
- Playbook:
apache.yml
- Credentials:
Linux Servers
- Verbosity:
0 (Normal)
- Name:
- Save
Create Survey (User Input):
- In Template, click “Survey”
- Enable Survey
- Add Question:
- Prompt:
Server Port
- Answer Variable:
http_port
- Answer Type:
Integer
- Default:
80
- Prompt:
- Save
Launch Job:
- Click “Launch” 🚀
- Fill survey if prompted
- Watch real-time output!
Job is running! Watch the magic! ✨
🎮 Quick Examples
Example 1: Scheduled Automation
# Create schedule for template
1. Go to Templates → Your Template
2. Click "Schedules" → "Add"
3. Configure:
- Name: "Nightly Backup"
- Start Date/Time: Today 02:00
- Time Zone: Your timezone
- Repeat Frequency: Daily
4. Save
# Job runs automatically!
Example 2: Workflow Template
Create complex workflows:
- Click “Templates” → “Add” → “Workflow Template”
- Name:
Complete Deployment
- Save and click “Workflow Visualizer”
- Add nodes:
- Start → Install Package
- Install → Configure Service
- Configure → Run Tests
- Set node relationships and conditions
- Save and Launch!
Example 3: Dynamic Inventory
# Create inventory script
cat << 'EOF' > dynamic_inventory.py
#!/usr/bin/env python3
import json
inventory = {
"web": {
"hosts": ["web01", "web02"],
"vars": {
"ansible_user": "ansible"
}
},
"_meta": {
"hostvars": {
"web01": {"ansible_host": "192.168.1.10"},
"web02": {"ansible_host": "192.168.1.11"}
}
}
}
print(json.dumps(inventory))
EOF
# Add as inventory source in AWX
🚨 Fix Common Problems
Problem 1: AWX Pods Not Starting
Symptom: Pods in CrashLoopBackOff 😰
Fix:
# Check pod logs
kubectl logs awx-demo-web-xxxxx
# Common issue: Resource limits
kubectl describe pod awx-demo-web-xxxxx
# Increase resources
kubectl edit awx awx-demo
# Increase memory/cpu requests
# Check PVC
kubectl get pvc
# All should be Bound
# Restart deployment
kubectl delete awx awx-demo
kubectl apply -f awx-demo.yaml
Problem 2: Can’t Access Web UI
Symptom: Connection refused or timeout 🌐
Fix:
# Check service
kubectl get svc awx-demo-service
# Port forward for testing
kubectl port-forward svc/awx-demo-service 8080:80
# Access via localhost:8080
# Check ingress if using
kubectl get ingress
# Firewall check
sudo firewall-cmd --list-all
Problem 3: Jobs Failing
Symptom: Playbook runs fail immediately 🔴
Fix:
# Check credentials
# Verify SSH access from AWX container
# Test connectivity
kubectl exec -it awx-demo-task-xxxxx -- /bin/bash
$ ping target-host
$ ssh ansible@target-host
# Check project sync
# Projects → Your Project → Sync
# Increase job timeout
# Settings → Jobs → Default Job Timeout
# View detailed logs
# Jobs → Failed Job → View Output
📋 Simple Commands Summary
Task | Location | Purpose |
---|---|---|
Add playbooks | Projects | Source control sync |
Add hosts | Inventories | Target systems |
Create automation | Templates | Job definitions |
Run playbook | Templates → Launch | Execute automation |
Schedule jobs | Templates → Schedules | Recurring automation |
View results | Jobs | Execution history |
Manage teams | Teams | Collaboration |
API access | /api/v2/ | REST API |
Activity stream | Activity Stream | Audit trail |
Settings | Settings | Global config |
💡 Tips for Success
🚀 Performance Optimization
Make AWX super fast:
# Scale AWX components
kubectl scale deployment awx-demo-web --replicas=3
kubectl scale deployment awx-demo-task --replicas=2
# Increase database connections
kubectl edit configmap awx-demo-postgres-configuration
# max_connections = 200
# Enable fact caching
# Settings → Jobs → Enable Fact Cache
# Use Redis for caching
🔒 Security Best Practices
Keep AWX secure:
- Use HTTPS - Configure SSL certificates! 🔐
- LDAP/SAML - Integrate authentication! 👥
- RBAC - Limit user permissions! 🛡️
- Credential encryption - Vault integration! 🔑
- Audit logging - Track everything! 📝
# Enable HTTPS
kubectl create secret tls awx-tls \
--cert=cert.pem \
--key=key.pem
# Update AWX spec
# spec:
# ingress_type: ingress
# ingress_tls_secret: awx-tls
📊 Monitoring and Backup
Keep AWX healthy:
# Backup AWX
awx-manage export_db --backup-file /backup/awx-backup.tar.gz
# Monitor with Prometheus
# Settings → System → Enable Metrics
# Regular maintenance
kubectl exec awx-demo-task-xxxxx -- \
awx-manage cleanup_jobs --days=30
🏆 What You Learned
You’re now an AWX automation expert! 🎓 You’ve successfully:
- ✅ Installed AWX on AlmaLinux 9
- ✅ Deployed using Kubernetes operator
- ✅ Created projects and inventories
- ✅ Built job templates
- ✅ Scheduled automation
- ✅ Managed playbooks visually
- ✅ Mastered enterprise automation
Your automation platform is enterprise-ready! 🤖
🎯 Why This Matters
AWX transforms infrastructure automation! With your automation platform, you can:
- 🚀 Automate everything - From simple to complex!
- 👥 Collaborate easily - Teams work together!
- 📅 Schedule smartly - Automation on autopilot!
- 📊 Track completely - Full audit trail!
- 💰 Save money - Enterprise features free!
You’re not just running playbooks - you’re orchestrating enterprise automation at scale! Every task is tracked, every change is audited! 🎭
Keep automating, keep scaling, and remember - with AWX, enterprise automation is free and powerful! ⭐
May your playbooks run smoothly and your automation never sleep! 🚀🤖🙌