Ansible : Install AWX2022/07/22 |
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 ~]# dnf -y install git make
|
[3] | Start Minikube as a common user. |
[cent@dlp ~]$ minikube start --vm-driver=kvm2 --cpus=4 --memory=8g --addons=ingress * minikube v1.33.1 on Centos 9 (kvm/amd64) * Using the kvm2 driver based on user configuration * Downloading VM boot image ... > minikube-v1.33.1-amd64.iso....: 65 B / 65 B [---------] 100.00% ? p/s 0s > minikube-v1.33.1-amd64.iso: 314.16 MiB / 314.16 MiB 100.00% 37.95 MiB p * Starting "minikube" primary control-plane node in "minikube" cluster ..... ..... * Verifying ingress addon... * Enabled addons: storage-provisioner, default-storageclass, ingress * Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default[cent@dlp ~]$ minikube status minikube type: Control Plane host: Running kubelet: Running apiserver: Running kubeconfig: Configured[cent@dlp ~]$ kubectl get pods -A NAMESPACE NAME READY STATUS RESTARTS AGE ingress-nginx ingress-nginx-admission-create-rmmbs 0/1 Completed 0 48s ingress-nginx ingress-nginx-admission-patch-fbdjg 0/1 Completed 0 48s ingress-nginx ingress-nginx-controller-768f948f8f-gsm6p 1/1 Running 0 47s kube-system coredns-7db6d8ff4d-2bsx2 1/1 Running 0 47s kube-system etcd-minikube 1/1 Running 0 62s kube-system kube-apiserver-minikube 1/1 Running 0 64s kube-system kube-controller-manager-minikube 1/1 Running 0 64s kube-system kube-proxy-pxkh2 1/1 Running 0 47s kube-system kube-scheduler-minikube 1/1 Running 0 62s kube-system storage-provisioner 1/1 Running 1 (17s ago) 60s |
[4] | Deploy Ansible AWX. |
# get AWX Operator first [cent@dlp ~]$ git clone https://github.com/ansible/awx-operator.git Cloning into 'awx-operator'... remote: Enumerating objects: 10754, done. remote: Counting objects: 100% (2124/2124), done. remote: Compressing objects: 100% (622/622), done. remote: Total 10754 (delta 1714), reused 1721 (delta 1465), pack-reused 8630 Receiving objects: 100% (10754/10754), 3.14 MiB | 19.37 MiB/s, done. Resolving deltas: 100% (6210/6210), done.
[cent@dlp ~]$
cd awx-operator
# specify a version of AWX Operator # make sure versions : https://github.com/ansible/awx-operator/releases [cent@dlp awx-operator]$ git checkout 2.19.0 Note: switching to '2.19.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 e3c2720 Wait for instance ready in molecule test (#1901) # set any namespace you like for AWX and deploy Operator [cent@dlp awx-operator]$ export NAMESPACE=ansible-awx [cent@dlp awx-operator]$ make deploy namespace/ansible-awx created customresourcedefinition.apiextensions.k8s.io/awxbackups.awx.ansible.com created customresourcedefinition.apiextensions.k8s.io/awxmeshingresses.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[cent@dlp awx-operator]$ kubectl get pods -n $NAMESPACE NAME READY STATUS RESTARTS AGE awx-operator-controller-manager-767776fdb4-js2g5 1/2 Running 0 41s
[cent@dlp awx-operator]$
cp awx-demo.yml ansible-awx.yml [cent@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 [cent@dlp awx-operator]$ kubectl config set-context --current --namespace=$NAMESPACE Context "minikube" modified. [cent@dlp awx-operator]$ kubectl apply -f ansible-awx.yml awx.awx.ansible.com/ansible-awx created # possible to see installation progress on the logs [cent@dlp awx-operator]$ kubectl logs -f deployments/awx-operator-controller-manager -c awx-manager
.....
.....
--------------------------- Ansible Task StdOut -------------------------------
TASK [installer : Start installation if auto_upgrade is false and deployment is missing] ***
task path: /opt/ansible/roles/installer/tasks/main.yml:31
-------------------------------------------------------------------------------
{"level":"info","ts":"2024-08-09T01:48:23Z","logger":"runner","msg":"Ansible-runner exited successfully","job":"3018899058444071018","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=88 changed=0 unreachable=0 failed=0 skipped=84 rescued=0 ignored=1
# that's OK if finished with [failed=0]
[cent@dlp ~]$ kubectl get pods -l "app.kubernetes.io/managed-by=awx-operator" NAME READY STATUS RESTARTS AGE ansible-awx-migration-24.6.0-xxgqv 0/1 Completed 0 6m6s ansible-awx-postgres-15-0 1/1 Running 0 7m33s ansible-awx-task-8598d45cb7-bbdhj 4/4 Running 0 6m54s ansible-awx-web-7c6f768776-x5d5c 3/3 Running 0 6m55s[cent@dlp ~]$ kubectl get service -l "app.kubernetes.io/managed-by=awx-operator" NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE ansible-awx-postgres-15 ClusterIP None <none> 5432/TCP 7m53s ansible-awx-service NodePort 10.96.213.115 <none> 80:32077/TCP 7m17s # display service URL [cent@dlp ~]$ minikube service ansible-awx-service --url -n ansible-awx http://192.168.39.223:32077 # confirm password for admin account [cent@dlp ~]$ kubectl get secret ansible-awx-admin-password -o jsonpath="{.data.password}" | base64 --decode; echo hBe6N0MVGzjc8iTedX3pHeJJLkafXx2M # 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 [cent@dlp ~]$ kubectl port-forward service/ansible-awx-service --address 0.0.0.0 10445:80 Forwarding from 0.0.0.0:10445 -> 8052 # if using port forwarding and Firewalld is running, allow port with root privilege [root@dlp ~]# firewall-cmd --add-port=10445/tcp [root@dlp ~]# firewall-cmd --runtime-to-permanent |
[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. |
Sponsored Link |