Hello Geeks, I hope you are aware about Ansible AWX, if not then Ansible AWX is a Web based GUI tool for managing ansible playbooks. There are lot of other features of AWX apart from execution of Ansible playbooks like source management integration, logging RBAC and more.
In other words, we can say Ansible AWX is considered as an upstream project of Red HAT Ansible Tower. From AWX version 18.x and onwards, installation focus is moved from docker to Kubernetes. So, in this article, we will cover the step by step Ansible AWX Installation on Kubernetes Minikube.
I am assuming Minikube is already installed on your Linux system. If not, then use below URL:
Note: Make sure you start your minikube cluster with enough resources (at least 4 vCPU and 8 GB RAM) , in my case I have started minikube with following resources and options.
$ minikube start --addons=ingress --cpus=4 --cni=flannel --install-addons=true --kubernetes-version=stable --memory=8g
Verify the Minikube Cluster Installation
Run following commands to verify the minikube installation and cluster status,
$ minikube status $ kubectl cluster-info $ kubectl get nodes
Output of above commands should look like below:
Perfect, above confirms that minikube has been installed and started successfully. Let’s move to AWX installation steps.
Step 1) Install AWX Operator
To install AWX operator, execute the following kubectl command,
$ kubectl apply -f https://raw.githubusercontent.com/ansible/awx-operator/0.12.0/deploy/awx-operator.yaml
Output
Run below command to confirm whether AWX operator’s pod is started or not. If not started then wait for couple of minutes as it takes time,
devops@linuxtechi:~$ kubectl get pods NAME READY STATUS RESTARTS AGE awx-operator-79bc95f78-pb7tz 1/1 Running 0 5m23s devops@linuxtechi:~$
Step 2) Create AWX Instance yaml file
Create ansible-awx.yml file with the following contents
$ vi ansible-awx.yml --- apiVersion: awx.ansible.com/v1beta1 kind: AWX metadata: name: ansible-awx spec: service_type: nodeport ingress_type: none hostname: ansible-awx.example.com
save and quit the file.
Step 3) Deploy Ansible AWX Instance
Now, let’s deploy AWX instance in our cluster by executing below command,
devops@linuxtechi:~$ kubectl apply -f ansible-awx.yml awx.awx.ansible.com/ansible-awx created devops@linuxtechi:~$
Above will create a deployment with a name ’ansible-awx’ and this deployment will have two pods and services.
After couple of minutes, Ansible AWX will be deployed and in case you wish to monitor installation logs then use below command,
$ kubectl logs -f deployment/awx-operator
Run below command to verify the status of AWX Pods,
devops@linuxtechi:~$ kubectl get pods -l "app.kubernetes.io/managed-by=awx-operator" NAME READY STATUS RESTARTS AGE ansible-awx-5ddfccf664-vrdq2 4/4 Running 0 7m40s ansible-awx-postgres-0 1/1 Running 0 8m24s devops@linuxtechi:~$
Run following command to view the service status,
devops@linuxtechi:~$ kubectl get svc -l "app.kubernetes.io/managed-by=awx-operator" NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE ansible-awx-postgres ClusterIP None <none> 5432/TCP 8m31s ansible-awx-service NodePort 10.97.206.89 <none> 80:32483/TCP 7m55s devops@linuxtechi:~$
Please make a note of node port of ‘ansible-awx-service’, we will be using it later for port forwarding.
Step 4) Access AWX Portal via tunneling
To access AWX portal outside of minikube cluster, we must configure the tunneling, run
devops@linuxtechi:~$ nohup minikube tunnel & [3] 35709 devops@linuxtechi:~$ devops@linuxtechi:~$ kubectl get svc ansible-awx-service NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE ansible-awx-service NodePort 10.97.206.89 <none> 80:32483/TCP 90m devops@linuxtechi:~$
Set the port forwarding in such a way that, if the request is coming on minikube IP on node port ‘32483’ then it should be redirected to port 80 of awx pod.
devops@linuxtechi:~$ kubectl port-forward svc/ansible-awx-service --address 0.0.0.0 32483:80 &> /dev/null & [4] 46686 devops@linuxtechi:~$
Now try to access AWX portal from the web browser by using minikube ip address and node port 32483
http://<minikube-ip>:<node-port>
To get the credentials, go back to terminal and run beneath command.
devops@linuxtechi:~$ kubectl get secret ansible-awx-admin-password -o jsonpath="{.data.password}" | base64 --decode PWrwGWBFCmpd1b47DJffCtK5SqYGzxXF devops@linuxtechi:~$
Use the username as ‘admin’ and the password as the output of above command, after entering the credentials we will get following dashboard
Great, above confirms that Ansible AWX is installed successfully on Kubernetes minikube. That’s all from this article. I hope you have found it informative and in case you have any queries, feel free to write us in below comments section.
Read Also : How to Run and Schedule Ansible Playbook Using AWX GUI
Hello,
I have followed the commands and installed AWX but cannot get UI on the browser. I can telnet on the server but not from outside the server. Can you help me with what might be wrong?
Thanks
Hi Krishna,
I would suggest check whether tunneling and port-formatting is configured correctly or not.
Apart from this also check status of AWX pods.
Hi,
This is a spot on guide. Thank you. Are there any specific options, so this will start automatically after the server reboot?
Hi Bogdan,
By default there is no specific option to start the Minikube cluster automatically after the reboot.
We have to manually start the cluster post reboot.
Hi , thanks for this good guide.
I have questions ;
1- when server restarting , the minikube starting automatically or not ?
2- how to change this nodeport 32483 to 80 ?
Great tutorial, I never get the ansible-awx pod 4/4 to start – the postgress one starts straight away
same trouble, in awx-operator 0.13.0 some error? can’t start awx with new version (
You must use kubernetes version 1.21.0 (not 1.22.0) – explanation here ‘https://github.com/ansible/awx-operator/issues/548’
Hi Pradeep
thanks for the tutorial. I have ansible-awx-postgres-0 pod running but I can’t see ansible-awx-xxxxxx-xxxxx 4/4 pod…
log’s faces bucle with this messages
————————– Ansible Task Status Event StdOut —————–
PLAY RECAP *********************************************************************
localhost : ok=29 changed=0 unreachable=0 failed=1 skipped=27 rescued=0 ignored=0
For anyone that can’t get the 4th pod to start, it’s resources, you need to increase the RAM minikube has available
Hi Pradeep,
Can you please help with below queries.
1) The path /var/log/awx is not accessible, please let me know how to access it?
2) Ldap binding is not working on the the web interface, please let us know how to check the AWX web logs.
3) how to configure secure web access (https)
4) Do we have any user guide for this deployment ?
Thank you in advanc3.
Thanks,
Sunil.K
Sorry there was typo in previous in comment I meant /var/lib/awx/*
For the command – kubectl port-forward svc/ansible-awx-service –address 0.0.0.0 32483:80 &> /dev/null &
Should that IP be the local IP of my host I installed minikube on?
I’m like a few others, I can’t get the GUI to open either, using localhost or placing the IP of my local host in the command mentioned above.
I am having difficulties enabling https for awx running in minikube.
Kindly advise.