Ansible AWX is a free and open source Ansible Management tool created to provide System Administrators and Developers with an easy to use, intuitive and powerful web-based user interface for managing Ansible playbooks, Secrets, inventories, and Automation cron jobs scheduled to run at certain intervals. This guide explains how to install Ansible AWX on Debian 10 (Buster) Linux system.

Step 1: Update Debian system

Update and upgrade your Debian System before you install Ansible AWX:

sudo apt update && sudo apt -y upgrade

A reboot is recommended whenever an upgrade is performed:

sudo reboot

Step 2: Install Single Node k3s Kubernetes

We will deploy a single node kubernetes using k3s lightweight tool. K3s is a certified Kubernetes distribution designed for production workloads in unattended, resource-constrained environments. The good thing with k3s is that you can add more Worker nodes at later stage if need arises.

Install K3s Kubernetes on your Debian system by running the following command:

curl -sfL https://get.k3s.io | sudo bash -

Expected installation output – The process should complete in few seconds / minutes.

[INFO]  Finding release for channel stable
[INFO]  Using v1.21.2+k3s1 as release
[INFO]  Downloading hash https://github.com/k3s-io/k3s/releases/download/v1.21.2+k3s1/sha256sum-amd64.txt
[INFO]  Downloading binary https://github.com/k3s-io/k3s/releases/download/v1.21.2+k3s1/k3s
[INFO]  Verifying binary download
[INFO]  Installing k3s to /usr/local/bin/k3s
[INFO]  Creating /usr/local/bin/kubectl symlink to k3s
[INFO]  Creating /usr/local/bin/crictl symlink to k3s
[INFO]  Creating /usr/local/bin/ctr symlink to k3s
[INFO]  Creating killall script /usr/local/bin/k3s-killall.sh
[INFO]  Creating uninstall script /usr/local/bin/k3s-uninstall.sh
[INFO]  env: Creating environment file /etc/systemd/system/k3s.service.env
[INFO]  systemd: Creating service file /etc/systemd/system/k3s.service
[INFO]  systemd: Enabling k3s unit
Created symlink /etc/systemd/system/multi-user.target.wants/k3s.service → /etc/systemd/system/k3s.service.
[INFO]  systemd: Starting k3s

After installation kubectl is configured for you, use it to check cluster details:

$ kubectl get nodes
NAME     STATUS   ROLES                  AGE   VERSION
ubuntu   Ready    control-plane,master   33s   v1.21.2+k3s1

Step 3: Deploy AWX Operator on Kubernetes

The AWX Operator is used to manage one or more AWX instances in any namespace within the cluster.

Let’s install the AWX Operator by running below command:

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

This creates required Custom Resources, ClusterRoles, ServiceAccount, and lastly the deployment.

customresourcedefinition.apiextensions.k8s.io/awxs.awx.ansible.com created
customresourcedefinition.apiextensions.k8s.io/awxbackups.awx.ansible.com created
customresourcedefinition.apiextensions.k8s.io/awxrestores.awx.ansible.com created
clusterrole.rbac.authorization.k8s.io/awx-operator created
clusterrolebinding.rbac.authorization.k8s.io/awx-operator created
serviceaccount/awx-operator created
deployment.apps/awx-operator created

After a few minutes  awx-operator should be in a running status:

$ kubectl get pods
NAME                            READY   STATUS    RESTARTS   AGE
awx-operator-545497f7d5-dgjs8   1/1     Running   0          84s

Step 4: Deploy AWX on Ubuntu 20.04/18.04 on K3s

We need to persist Web Application data by creating a PVC – Reference AWX data persistence. Execute below commands in the terminal to initiate PersistentVolumeClaim creation:

cat <<EOF | kubectl create -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: static-data-pvc
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: local-path
  resources:
    requests:
      storage: 1Gi
EOF

Create AWX deployment instance deployment YAML file:

tee awx-deploy.yml<<EOF
---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
  name: awx
spec:
  service_type: nodeport
  projects_persistence: true
  projects_storage_access_mode: ReadWriteOnce
  web_extra_volume_mounts: |
    - name: static-data
      mountPath: /var/lib/awx/public
  extra_volumes: |
    - name: static-data
      persistentVolumeClaim:
        claimName: static-data-pvc
EOF

Apply configuration to create required objects:

$ kubectl apply -f awx-deploy.yml
awx.awx.ansible.com/awx created

Wait a few minutes then check AWX instance deployed:

$ kubectl get pods -l "app.kubernetes.io/managed-by=awx-operator"
NAME                   READY   STATUS    RESTARTS   AGE
awx-postgres-0         1/1     Running   0          75s
awx-7c5d846c88-mjlvm   4/4     Running   0          64s

If you experience any issues with the Pods starting check deployment logs:

$ kubectl logs -f deployments/awx-operator

The database data will be persistent as they are stored in a persistent volume:

$ kubectl get pvc
NAME                      STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
postgres-awx-postgres-0   Bound    pvc-c0149545-8631-4aa1-a03f-2134a7f42aa6   8Gi        RWO            local-path     84s
static-data-pvc           Bound    pvc-6b6005de-0888-4634-b0a2-d5cc92eb85cc   1Gi        RWO            local-path     2m10s
awx-projects-claim        Bound    pvc-91e751e9-0e8e-40c8-9953-f8d9db5f612b   8Gi        RWO            local-path     77s

Volumes are created using local-path-provisioner and host path

$ ls /var/lib/rancher/k3s/storage/
pvc-edb29795-7dae-4a00-805f-2d989694fe3d_default_postgres-awx-postgres-0

List all available services and check awx-service Nodeport

$ kubectl get svc -l "app.kubernetes.io/managed-by=awx-operator"
NAME           TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE
awx-postgres   ClusterIP   None           <none>        5432/TCP       2m5s
awx-service    NodePort    10.43.182.53   <none>        80:32708/TCP   116s

You can edit the Node Port and set to figure of your preference, but has to be >=32000

$ kubectl edit svc awx-service
....
ports:
  - name: http
    nodePort: 32000
    port: 80
    protocol: TCP
    targetPort: 8052

If you have an Ingress controller in the Cluster you can create an route for AWX application to access the app over Domain name.

Step 5: Access Ansible AWX Dashboard

Ansible AWX web portal is now accessible on http://hostip_or_hostname:32000.

install ansible awx ubuntu using operator 01

Obtain admin user password by decoding the secret with the password value:

kubectl get secret awx-admin-password -o go-template='{{range $k,$v := .data}}{{printf "%s: " $k}}{{if not $v}}{{$v}}{{else}}{{$v | base64decode}}{{end}}{{"\n"}}{{end}}'

Login with user admin and decoded password:

install ansible awx ubuntu using operator 02

There you have AWX Administration interface. Start adding inventory, importing Ansible roles and automate your Infrastructure and Applications deployment.

install ansible awx ubuntu using operator 03

Related guides.

Install Ansible AWX on Ubuntu

How To Install and Configure Ansible Tower on CentOS 7

Install Ansible AWX on CentOS 7 / Fedora

Semaphore – Manage Ansible Tasks from A Web UI

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!


As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.

2 COMMENTS

  1. Hello,
    on step4 i don’t have the directory awx/installer/ when a type the command “cd”
    pwd indicate i’m in /root
    i have awx directory in /root
    i have another awx directory in awx : /root/awx/awx

    in this path i don’t have “installer”….

    could you help me please?
    i try on latest release of Debian 10

    Regards

LEAVE A REPLY

Please enter your comment!
Please enter your name here