AWX is a web based GUI tool for managing Ansible playbooks. It is the open source upstream project of Red Hat Automation Controller (formerly Ansible Tower) . As for Fedora and RHEL operating systems, the releases of Automation Controller are created from a branch of AWX, which sponsored is by Red Hat.
AWX provides user interface, REST API and task engine, allowing you to manage playbooks, inventories and schedule jobs using a web interface.
In this blog post, we will focus on the installation part only. Configuration and usage will be covered by other ones.
Minikube installation
Starting in with version 18.0, the installation method of AWX moved from Docker to Kubernetes. This is done thanks to the AWX Operator, providing a Kubernetes-native installation method for AWX. For this blog purpose, we will deploy it in a Minikube local Kubernetes environment which is easy to install on a Linux x86-64 system :
joc@jocbox:~$ sudo curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 66.3M 100 66.3M 0 0 8356k 0 0:00:08 0:00:08 --:--:-- 8941k joc@jocbox:~$ joc@jocbox:~$ sudo install minikube-linux-amd64 /usr/local/bin/minikube joc@jocbox:~$
Nothing more to do to have an up & running cluster. Let’s start it :
joc@jocbox:~$ minikube start 😄 minikube v1.24.0 on Linuxmint 20.2 ✨ Automatically selected the docker driver. Other choices: kvm2, virtualbox, ssh, none 👍 Starting control plane node minikube in cluster minikube 🚜 Pulling base image ... 💾 Downloading Kubernetes v1.22.3 preload ... > preloaded-images-k8s-v13-v1...: 501.73 MiB / 501.73 MiB 100.00% 4.58 MiB > gcr.io/k8s-minikube/kicbase: 355.78 MiB / 355.78 MiB 100.00% 3.02 MiB p/ 🔥 Creating docker container (CPUs=2, Memory=3900MB) ... 🐳 Preparing Kubernetes v1.22.3 on Docker 20.10.8 ... ▪ Generating certificates and keys ... ▪ Booting up control plane ... ▪ Configuring RBAC rules ... 🔎 Verifying Kubernetes components... ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5 🌟 Enabled addons: storage-provisioner, default-storageclass 💡 kubectl not found. If you need it, try: 'minikube kubectl -- get pods -A' 🏄 Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default joc@jocbox:~$
There are two ways to interact with the Minikube cluster. First one ist to use kubectl that you can install using e.g. the Snap package manager :
joc@jocbox:~$ sudo snap install kubectl --classic kubectl 1.22.4 from Canonical✓ installed joc@jocbox:~$
But actually, installing kubectl is not mandatory, since it comes already wrapped inside Minikube. To use it, simply prefix the kubectl commands with “minikube kubectl –“. To save time while writing, why not create an alias :
joc@jocbox:~$ alias kubectl="minikube kubectl --"
To test kubectl, you can use it to list the pods created to run the Kubernetes engine :
joc@jocbox:~$ kubectl get pods -A NAMESPACE NAME READY STATUS RESTARTS AGE kube-system coredns-78fcd69978-cb4z6 1/1 Running 1 (43m ago) 10h kube-system etcd-minikube 1/1 Running 1 (43m ago) 10h kube-system kube-apiserver-minikube 1/1 Running 1 (43m ago) 10h kube-system kube-controller-manager-minikube 1/1 Running 1 (43m ago) 10h kube-system kube-proxy-khgb4 1/1 Running 1 (43m ago) 10h kube-system kube-scheduler-minikube 1/1 Running 1 (43m ago) 10h kube-system storage-provisioner 1/1 Running 3 (42m ago) 10h kubernetes-dashboard dashboard-metrics-scraper-5594458c94-nphf6 1/1 Running 1 (43m ago) 10h kubernetes-dashboard kubernetes-dashboard-654cf69797-4dbjh 1/1 Running 1 (43m ago) 10h joc@jocbox:~$
AWX Operator installation
Let’s move to the AWX Operator deployment into your cluster. The first thing to do is to clone the git repository of the project :
joc@jocbox:~$ git clone https://github.com/ansible/awx-operator.git Cloning into 'awx-operator'... remote: Enumerating objects: 5952, done. remote: Counting objects: 100% (1867/1867), done. remote: Compressing objects: 100% (362/362), done. remote: Total 5952 (delta 1673), reused 1505 (delta 1505), pack-reused 4085 Receiving objects: 100% (5952/5952), 1.40 MiB | 7.49 MiB/s, done. Resolving deltas: 100% (3462/3462), done. joc@jocbox:~$
Before starting the deployment, it’s better to set the namespace into which you want to deploy (otherwise the Operator will be installed into the default namespace). Then run the “make deploy” command from the repository :
joc@jocbox:~/awx-operator$ export NAMESPACE=awx joc@jocbox:~/awx-operator$ make deploy cd config/manager && /home/joc/awx-operator/bin/kustomize edit set image controller=quay.io/ansible/awx-operator:0.14.0 cd config/default && /home/joc/awx-operator/bin/kustomize edit set namespace awx /home/joc/awx-operator/bin/kustomize build config/default | kubectl apply -f - namespace/awx created customresourcedefinition.apiextensions.k8s.io/awxbackups.awx.ansible.com created customresourcedefinition.apiextensions.k8s.io/awxrestores.awx.ansible.com created customresourcedefinition.apiextensions.k8s.io/awxs.awx.ansible.com created serviceaccount/awx-operator-controller-manager created role.rbac.authorization.k8s.io/awx-operator-leader-election-role created role.rbac.authorization.k8s.io/awx-operator-manager-role created clusterrole.rbac.authorization.k8s.io/awx-operator-metrics-reader created clusterrole.rbac.authorization.k8s.io/awx-operator-proxy-role created rolebinding.rbac.authorization.k8s.io/awx-operator-leader-election-rolebinding created rolebinding.rbac.authorization.k8s.io/awx-operator-manager-rolebinding created clusterrolebinding.rbac.authorization.k8s.io/awx-operator-proxy-rolebinding created configmap/awx-operator-manager-config created service/awx-operator-controller-manager-metrics-service created deployment.apps/awx-operator-controller-manager created joc@jocbox:~/awx-operator$
Hint : you can now configure you current context to run by default all kubectl commands against your new namespace :
joc@jocbox:~$ kubectl config set-context --current --namespace=awx Context "minikube" modified. joc@jocbox:~$
After few minutes, the AWX Operator is running into a new pod :
joc@jocbox:~/awx-operator$ kubectl get pods NAME READY STATUS RESTARTS AGE awx-operator-controller-manager-68d787cfbd-xmshs 2/2 Running 2 (62m ago) 8h joc@jocbox:~/awx-operator$
AWX deployment
The AWX installation is very straight forward. If you want to give a specific name to your AWX deployment, edit the metadata.name section in the awx-demo.yml file :
joc@jocbox:~/awx-operator$ cat awx-demo.yml --- apiVersion: awx.ansible.com/v1beta1 kind: AWX metadata: name: awx-joc spec: service_type: nodeport joc@jocbox:~/awx-operator$
Finally, apply the yaml file to create the AWX instance in your cluster :
joc@jocbox:~/awx-operator$ kubectl apply -f awx-demo.yml awx.awx.ansible.com/awx-joc created joc@jocbox:~/awx-operator$
Once done, you can check the new pods and services :
joc@jocbox:~/awx-operator$ kubectl get pods NAME READY STATUS RESTARTS AGE awx-joc-9d964f6bc-98d99 4/4 Running 12 (12h ago) 5d20h awx-joc-postgres-0 1/1 Running 3 (12h ago) 5d20h awx-operator-controller-manager-68d787cfbd-xmshs 2/2 Running 6 (12h ago) 5d20h joc@jocbox:~/awx-operator$ kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE awx-joc-postgres ClusterIP None <none> 5432/TCP 5d20h awx-joc-service NodePort 10.108.183.108 <none> 80:32283/TCP 5d20h awx-operator-controller-manager-metrics-service ClusterIP 10.102.106.17 <none> 8443/TCP 5d21h joc@jocbox:~/awx-operator$
Run the following command to get the URL of the web interface
joc@jocbox:~/awx-operator$ minikube service awx-joc-service --url -n awx http://192.168.49.2:32283 joc@jocbox:~/awx-operator$
And try it :
Looks good ! The default username is “admin”. To know the password, go back to your shell and retrieve it as follow :
joc@jocbox:~/awx-operator$ kubectl get secret awx-joc-admin-password -o jsonpath="{.data.password}" | base64 --decode LbcA6yarpcRcnDMeBTJvZnJ8hf7wXXxa joc@jocbox:~/awx-operator$
Go back to your browser, log in and be ready to play with your new AWX platform :