How to Install and Configure Ansible AWX on Rocky Linux 8

AWX stands for “Ansible Web eXecutable” is a free and open-source project that allows you to easily manage and control Ansible projects. AWX is the upstream project of Red Hat Ansible Automation Platform. AWX provides a web-based user interface, a powerful REST API and allows to manage or sync inventory with other cloud sources

Install AWX Operator Installtion on K3S

img placeholder

The open source projects Ansible and AWX, is a task engine and Web interface for scheduling and running playbook tasks on the inventories the playbooks interact with.

In this tutorial, we will install and configure Ansible AWX operator on Rocky Linux 8

Steps involved
  1. Install Rocky Linux 8.x or CentOS 8.x server with a minimum of 4 GB RAM.
  2. Install K3S
  3. Install AWX operator on K3s

Refer to this post for K3S installation Install K3S

Once we have a running kubernetes cluster( in this case K3s), we can deploy AWX Operator into the cluster using Kustomize.

Install AWX Operator:

Install pre-requisites with the following command

1sudo yum -y install git make

img placeholder

Manually create a file called kustomization.yaml with the following content:

1vi kustomization.yaml

Find the latest tag here: https://github.com/ansible/awx-operator/releases. In this case, I have used 2.6.0

1apiVersion: kustomize.config.k8s.io/v1beta1
2kind: Kustomization
3resources:
4  - github.com/ansible/awx-operator/config/default?ref=2.6.0
5images:
6  - name: quay.io/ansible/awx-operator
7    newTag: 2.6.0
8namespace: awx

img placeholder

Install the manifests by running this

1kubectl apply -k .

img placeholder
Wait a bit until the awx-operator running. we can check this by running

1kubectl get pods -n awx

Manually create a file called awx-lab.yaml

1vi awx-lab.yaml

in awx-lab.yaml, copy the below content

1---
2apiVersion: awx.ansible.com/v1beta1
3kind: AWX
4metadata:
5  name: awx-demo
6spec:
7  service_type: nodeport

img placeholder

Make sure to add this new file to the list of "resources" in kustomization.yaml file

1apiVersion: kustomize.config.k8s.io/v1beta1
2kind: Kustomization
3resources:
4  - github.com/ansible/awx-operator/config/default?ref=2.6.0
5  - awx-lab.yaml
6images:
7  - name: quay.io/ansible/awx-operator
8    newTag: 2.6.0
9namespace: awx

img placeholder

Finally, apply the changes to create the AWX instance in the cluster

1kubectl apply -k .

We don't have to keep repeating -n awx, let's set the current namespace for kubectl:

1kubectl config set-context --current --namespace=awx

After few minutes, the new AWX instance will be deployed. we can check the logs using the following command, in order to know where the installation process is at

1kubectl logs -f deployments/awx-operator-controller-manager -c awx-manager

After few seconds, we should see the operator begin to create new resources

1kubectl get pods -l "app.kubernetes.io/managed-by=awx-operator"

img placeholder

Get the Node port details by running the following command

1kubectl get svc -l "app.kubernetes.io/managed-by=awx-operator"

img placeholder

By default, the admin user is admin and the password is available in the -admin-password secret. To retrieve the admin password, run

1kubectl get secret awx-demo-admin-password -o jsonpath="{.data.password}" | base64 --decode ; echo

img placeholder

Launch the URL using the <hostname:port>, and login the with admin/password noted with above command

img placeholder

Watch the video on How to Setup AWX Operator in K3S cluster