Cyber Deals - Get up to 65% off on CKA, CKAD, CKS, KCNA, KCSA exams and courses!

Install Ansible AWX using AWX Operator (on Kubernetes)

Install Ansible AWX using AWX Operator (on Kubernetes)

Setup a Kubernete s Cluster

We will install it on a minikube. (Refere minikube installation)

$ minikube start --addons=ingress --cni=flannel --install-addons=true \
    --kubernetes-version=stable \
    --vm-driver=docker --wait=false \
    --cpus=4 --memory=6g

Enable Addons as needed

## Check addons
$ minikube addons list
$ minikube addons enable metrics-server
$ minikube dashboard

Deploy AWX Operator

Replace TAG with the version from Release Page

kubectl apply -f https://raw.githubusercontent.com/ansible/awx-operator/<TAG>/deploy/awx-operator.yaml

Create AWX Deployment

Create a file awx-demo.yaml

---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
  name: awx-demo
spec:
  service_type: nodeport
  ingress_type: none
  hostname: awx-demo.example.com
$ kubectl apply -f awx-demo.yml
awx.awx.ansible.com/awx-demo created

Refer AWX Operator documentation for advanced installation options.

Get Admin Password

By default, the admin user is admin and the password is available in the <resourcename>-admin-password secret.

$ kubectl get secret awx-demo-admin-password -o jsonpath="{.data.password}" | base64 --decode
lxQ8uWlE9Wevkgmy5Kx2AqFdY80v34gx

Get the Path to Access Ansible AWX

You will find the NodePort and IP for service awx-demo-service

$ kubectl get svc
NAME                   TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)             AGE
awx-demo-postgres      ClusterIP   None             <none>        5432/TCP            23m
awx-demo-service       NodePort    10.110.146.161   <none>        80:31726/TCP        23m
awx-operator-metrics   ClusterIP   10.104.113.88    <none>        8383/TCP,8686/TCP   23m
kubernetes             ClusterIP   10.96.0.1        <none>        443/TCP             26m

Access Ansible AWX Portal at IP_ADDRESS:NODE_PORT.

Or let minikube open the browser

$ minikube service hello-minikube

Access Ansible AWX on Remote Minikube or Kubernetes Cluster

If your Kubernetes/minikube Cluster is on Remote Machine/VM (eg: Cloud Instance with Public IP) then you can access it using above method (if NodePort is same is remote IP) or you can use LoadBalancer methods.

In our case, we have deplyed this in a Google Cloud instance without GUI and we need to enabled port-forwading as below.

## Forward localhost (minkube VM Localhost) port 7080 -> 80
$ kubectl port-forward service/awx-demo-service 7080:80

So the Ansible AWX service is available at minikube VM localhost:7080 now; but we dont have GUI there to access !!

So, we do a port-forwarding from our laptop/workstation via SSH Tunnel.

## On your Workstation/Laptop
## ssh -L LOCAL_PORT:localhost:REMOTE_PORT User@REMOTE_IP
$ ssh -L 7080:localhost:7080 [email protected]

Now, open a browser on your laptop/workstation and goto localhost:7080; that’s it.

Enjoy Ansible AWX running on top of Kubernetes/minikube.

References

Disclaimer: Views expressed in articles are those of the respective authors and do not necessarily reflect the views of their employers or this site. While we aim for accuracy, please verify information before relying on it, and let us know if you spot an error.
Tags:
Share:

Related Posts

Red hat

RHEL to Active Directory

Reference Documents for Red Hat to Active Directory Connection Disjoin from AD

Ansible

Ansible awx cli

Note: This notes are based on the AAP 2.5 Installation # On Red Hat Enterprise Linux 8, the Controller CLI can be installed via dnf: dnf install …

Ansible

Azure Certifications

Microsoft Certified: Security, Compliance, and Identity Fundamentals Manage identity and access in Azure Active Directory Zero Trust Guidance Center …

Ansible

rancher

1. Introduction to Rancher & RKE 1.1. Rancher Architecture 1.2. Disocvering RKE 1.2.1. Node Preparation 1.2.2. Creating the Cluster Configuration …

Ansible

Ansible for Windows

Checkout the Ansible Automation for Windows guides. WinRM vs OpenSSH – Pros & Cons WinRM (Default) ✔️ Pros ❌ Cons 🆕 OpenSSH ✔️ Pros ❌ Cons 💡 Use …

Ansible for Infoblox

Ansible for Infoblox

Configure Ansible for Infoblox Install Python3 on RHEL Instal Python3 on Centos Setup Python VirtualEnv (venv) DONOT Upgrade pip to Latest !!! …