Ubuntu 22.04
Sponsored Link

Ansible : Install AWX2022/09/27

 
Install Ansible AWX that is the community edition of Red Hat Ansible Tower.
To install Ansible AWX, it needs Kubernetes infrastructure.
It's OK with not full Kubernetes cluster but MicroK8s, K3s or Minikube and so on.
Understandably, RedHat OpenShift or OKD that is the community edition of OpenShift are also ready.
[1]
On this example, use Minikube for AWX.
So install Minikube like here.
[2] Install other required packages.
root@dlp:~#
apt -y install git make
[3] Start Minikube as a common user.
ubuntu@dlp:~$
minikube start --vm-driver=kvm2 --cpus=4 --memory=8g --addons=ingress

* minikube v1.27.0 on Ubuntu 22.04 (kvm/amd64)
! Kubernetes 1.25.0 has a known issue with resolv.conf. minikube is using a workaround that should work for most use cases.
! For more information, see: https://github.com/kubernetes/kubernetes/issues/112135
* Using the kvm2 driver based on user configuration
* Downloading VM boot image ...
    > minikube-v1.27.0-amd64.iso....:  65 B / 65 B [---------] 100.00% ? p/s 0s
    > minikube-v1.27.0-amd64.iso:  273.79 MiB / 273.79 MiB  100.00% 49.08 MiB p

.....
.....

* Verifying ingress addon...
* Enabled addons: default-storageclass, storage-provisioner, ingress
* Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

ubuntu@dlp:~$
minikube status

minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured

ubuntu@dlp:~$
kubectl get pods -A

NAMESPACE       NAME                                        READY   STATUS      RESTARTS      AGE
ingress-nginx   ingress-nginx-admission-create-jwdlp        0/1     Completed   0             95s
ingress-nginx   ingress-nginx-admission-patch-5xc74         0/1     Completed   1             95s
ingress-nginx   ingress-nginx-controller-5959f988fd-rfwpt   1/1     Running     0             95s
kube-system     coredns-565d847f94-m2ld6                    1/1     Running     0             95s
kube-system     etcd-minikube                               1/1     Running     0             107s
kube-system     kube-apiserver-minikube                     1/1     Running     0             109s
kube-system     kube-controller-manager-minikube            1/1     Running     0             107s
kube-system     kube-proxy-qmgmj                            1/1     Running     0             95s
kube-system     kube-scheduler-minikube                     1/1     Running     0             107s
kube-system     storage-provisioner                         1/1     Running     1 (64s ago)   106s
[4] Deploy Ansible AWX.
# get AWX Operator first

ubuntu@dlp:~$
git clone https://github.com/ansible/awx-operator.git

Cloning into 'awx-operator'...
remote: Enumerating objects: 7311, done.
remote: Counting objects: 100% (318/318), done.
remote: Compressing objects: 100% (193/193), done.
remote: Total 7311 (delta 119), reused 264 (delta 100), pack-reused 6993
Receiving objects: 100% (7311/7311), 2.04 MiB | 4.49 MiB/s, done.
Resolving deltas: 100% (4131/4131), done.

ubuntu@dlp:~$
cd awx-operator
# specify a version of AWX Operator
# make sure versions : https://github.com/ansible/awx-operator/releases

ubuntu@dlp:~/awx-operator$
git checkout 0.17.0

Note: switching to '0.17.0'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at c02e059 Merge pull request #797 from kdelee/sky-is-the-limit

# set any namespace you like for AWX and deploy Operator

ubuntu@dlp:~/awx-operator$
export NAMESPACE=ansible-awx

ubuntu@dlp:~/awx-operator$
make deploy

namespace/ansible-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-awx-manager-role created
role.rbac.authorization.k8s.io/awx-operator-leader-election-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-awx-manager-rolebinding created
rolebinding.rbac.authorization.k8s.io/awx-operator-leader-election-rolebinding created
clusterrolebinding.rbac.authorization.k8s.io/awx-operator-proxy-rolebinding created
configmap/awx-operator-awx-manager-config created
service/awx-operator-controller-manager-metrics-service created
deployment.apps/awx-operator-controller-manager created

ubuntu@dlp:~/awx-operator$
kubectl get pods -n $NAMESPACE

NAME                                              READY   STATUS    RESTARTS   AGE
awx-operator-controller-manager-5cb5fb4d5-5npgx   2/2     Running   0          39s

ubuntu@dlp:~/awx-operator$
cp awx-demo.yml ansible-awx.yml

ubuntu@dlp:~/awx-operator$
vi ansible-awx.yml
# change to any service name you like

---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
  name: ansible-awx
spec:
  service_type: nodeport

# set namespace for AWX you set to kubectl context and deploy AWX

ubuntu@dlp:~/awx-operator$
kubectl config set-context --current --namespace=$NAMESPACE

Context "minikube" modified.
ubuntu@dlp:~/awx-operator$
kubectl apply -f ansible-awx.yml

awx.awx.ansible.com/ansible-awx created
# possible to see installation progress on the logs

ubuntu@dlp:~/awx-operator$
kubectl logs -f deployments/awx-operator-controller-manager -c awx-manager


.....
.....

--------------------------- Ansible Task StdOut -------------------------------

 TASK [Remove ownerReferences reference] ********************************
ok: [localhost] => (item=None) => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": false}

-------------------------------------------------------------------------------
{"level":"info","ts":1664258956.9169135,"logger":"runner","msg":"Ansible-runner exited successfully","job":"816107424561487953","name":"ansible-awx","namespace":"ansible-awx"}

----- Ansible Task Status Event StdOut (awx.ansible.com/v1beta1, Kind=AWX, ansible-awx/ansible-awx) -----


PLAY RECAP *********************************************************************
localhost                  : ok=63   changed=0    unreachable=0    failed=0    skipped=45   rescued=0    ignored=0

# that's OK if finished with [failed=0]


ubuntu@dlp:~$
kubectl get pods -l "app.kubernetes.io/managed-by=awx-operator"

NAME                           READY   STATUS    RESTARTS   AGE
ansible-awx-7776fd876b-7grdt   4/4     Running   0          4m52s
ansible-awx-postgres-0         1/1     Running   0          5m17s

ubuntu@dlp:~$
kubectl get service -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       5m37s
ansible-awx-service    NodePort    10.104.35.35   <none>        80:31788/TCP   5m14s

# display service URL

ubuntu@dlp:~$
minikube service ansible-awx-service --url -n ansible-awx

http://192.168.39.254:31788
# confirm password for admin account

ubuntu@dlp:~$
kubectl get secret ansible-awx-admin-password -o jsonpath="{.data.password}" | base64 --decode; echo

LDdqz3TuaCC7fYP7zOPpZu8pMZTgOBZP
# if you access from outside of Kubernetes cluster, it needs to set port forwarding
# [10445] ⇒ the port that Minikube installed host listens ⇒ specify any free port you like
# [80] ⇒ the port AWX container listens

ubuntu@dlp:~$
kubectl port-forward service/ansible-awx-service --address 0.0.0.0 10445:80

Forwarding from 0.0.0.0:10445 -> 8052
[5] Access to Ansible AWX with Web browser.
If you access from Minikube installed localhost, specify the service URL confirmed above.
If you set port forwarding, access to the URL [http://(Minikube installed hostname or IP address):(forwarding port)] on any computer in your local network.
After successfully accessed, AWX login form is shown.
It's possible to login with user [admin] and its password is the one you confirmed above.
[6] If successfully logined, Ansible AWX Dashboard is displayed. That's OK to install AWX.
Matched Content