Menu

Virtual Geek

Tales from real IT system administrators world and non-production environment

Install Ansible AWX on Microsoft Windows OS

I was working on upgrading my Ansible AWX server in my lab, while upgrading/installing fresh Ansible AWX Tower server I found the step by step instructions I tried long back Install Ansible AWX Tower on Ubuntu Linux are absolutes now and no longer working as Ansible AWX team made few changes to it. So this is the new guide to install AWX on windows os directly. In earlier I was used docker to containerize the Ansible AWX server application. Here I will use Minikube Kubernetes cluster to deploy Ansible AWX Server. All the steps are done using commands only.

Below is the configuration I am using to install Ansible AWX Tower on Windows 10 lab:
CPU: 4
Memory: 8 GB
Disk Space: 20 GB
Software: VMware Workstation (You can use Hyper-V, Docker or VirtualBox instead)
Virtualization must be enabled in the BIOS.

Ansible awx tower powershell kubernetes k8s docker vmware workstation vmrun vm-driver minikube run ansible awx redhat tower powershell microsoft windows 11 cmd.png

All the instructions I found are already on https://github.com/ansible/awx-operator. To start first I will install minikubeminikube is a tool that lets you run Kubernetes locally. minikube runs a single-node Kubernetes cluster on your personal computer (including Windows, macOS and Linux PCs) so that you can try out Kubernetes, or for daily development work. 

I have opened PowerShell and Here I am downloading minkube.exe for windows from github website. You can directly go to below website and download it and rename it to minikube.exe.

curl -Lo minikube.exe https://github.com/kubernetes/minikube/releases/latest/download/minikube-windows-amd64.exe

Once file is downloaded create a folder name after minikube on C drive.

if (-not(Test-Path C:\minikube)) {New-Item -Path "c:\" -Name "minikube" -ItemType "directory" -Force}

Copy downloaded file minikube.exe to C:\minikube folder.

if (Test-Path .\minikube.exe) {Move-Item .\minikube.exe c:\minikube\minikube.exe -Force}

Microsoft windows Powershell command prome install ansible awx tower redhat on window minikube kubernetes test-path new-item move-item minikube.exe releases.png

For next step, Run as Administrator PowerShell and execute below commands to add C:\minikube to environment variable path inside machines. Or you can do the same configuration manually also on the GUI.

run as administrator Microsoft Powershell corporation environment variable set get minikube machine or user ansible awx tower redhat kubernetes vmware workstation driver.png

$oldpath=[Environment]::GetEnvironmentVariable("Path", [EnvironmentVariableTarget]::Machine)
if($oldpath -notlike "*;C:\minikube*"){`
  [Environment]::SetEnvironmentVariable("Path", $oldpath+";C:\minikube", [EnvironmentVariableTarget]::Machine)`
}

Next Open new command prompt (cmd) and try command minikube --version to verify minikube is installed and its working properly.

Execute minikube start command to download required boot images and iso to create kubernetes minikube environment. Make sure you have sufficient CPU and Memory. Also make sure you have installed VMware Workstation as prerequisite (You can use Hyper-V, Docker or VirtualBox, SSH if you don't have VMware instead).

Check: MY VSPHERE LAB CONFIGURATION ON VMWARE WORKSTATION

Microsoft powershell minikube start command prompt ingress flannel windows 11 minikube start --vm-driver vmware memory kubernetese docker containerization rbac control plane kubectl get nodes.png

To know supported vm drivers list you can check on https://minikube.sigs.k8s.io/docs/drivers/

minikube start --addons=ingress --cpus=4 --cni=flannel --install-addons=true --kubernetes-version=stable --memory=6g --vm-driver=vmware

* minikube v1.22.0 on Microsoft Windows 10 Home Single Language 10.0.19043 Build 19043
* Using the vmware driver based on user configuration
* Downloading VM boot image ...
    > minikube-v1.22.0.iso.sha256: 65 B / 65 B [-------------] 100.00% ? p/s 0s
    > minikube-v1.22.0.iso: 242.95 MiB / 242.95 MiB [] 100.00% 4.99 MiB p/s 49s
* Starting control plane node minikube in cluster minikube
* Downloading Kubernetes v1.21.2 preload ...
    > preloaded-images-k8s-v11-v1...: 502.14 MiB / 502.14 MiB  100.00% 4.96 MiB
* Creating vmware VM (CPUs=4, Memory=6144MB, Disk=20000MB) ...
* Preparing Kubernetes v1.21.2 on Docker 20.10.6 ...
  - Generating certificates and keys ...
  - Booting up control plane ...
  - Configuring RBAC rules ...
* Configuring Flannel (Container Networking Interface) ...
* Verifying Kubernetes components...
  - Using image gcr.io/k8s-minikube/storage-provisioner:v5
  - Using image k8s.gcr.io/ingress-nginx/controller:v0.44.0
  - Using image docker.io/jettech/kube-webhook-certgen:v1.5.1
  - Using image docker.io/jettech/kube-webhook-certgen:v1.5.1
* Verifying ingress addon...
* Enabled addons: storage-provisioner, default-storageclass, ingress
* Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

It takes some time to download and configure minikube, once the process completed verify minikube environment is configured successfully by connecting to it's API server using minikube kubectl commands. If you are running kubectl for the first time it will download kubectl client and will give the status.

minikube kubectl -- get nodes
    > kubectl.exe.sha256: 64 B / 64 B [----------------------] 100.00% ? p/s 0s
    > kubectl.exe: 45.63 MiB / 45.63 MiB [-----------] 100.00% 4.41 MiB p/s 11s
NAME       STATUS   ROLES                  AGE     VERSION
minikube   Ready    control-plane,master   5m30s   v1.21.2

Check the latest version of awx-operator which you want to install on https://github.com/ansible/awx-operator/releases and replace it with mentioned red text tag. Apply the kubectl configuration. This creates the required configuration on minikube for kubernetes cluster.

minikube kubectl -- apply -f https://raw.githubusercontent.com/ansible/awx-operator/0.13.0/deploy/awx-operator.yaml
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

Microsoft Powershell command prompt cmd minikube kubectl apply githubusercontent raw customresourcedefinition api extensions k8s io awx ansible tower redhat clusterrole serviceaccount deployment awx-operator.png

Check below command after few minutes to verify awx-operator pod is running successfully.

minikube kubectl -- get pods
NAME                            READY   STATUS    RESTARTS   AGE
awx-operator-69c646c48f-hf5zf   1/1     Running   0          3m22s

Microsoft portal minikube kubectl -- get pods awx-operator running status awx ansible tower on windows powershell command prompt cmd minikube cluster k8s install ansible.png

Next I will create a awx deployment on minikube k8s, open a notepad and save below code information to the file. or use command notepad awx-demo.yml.

---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
  name: awx-demo
spec:
  service_type: nodeport
  ingress_type: none
  hostname: awx-demo.example.com

Microsoft Powershell cmd command prompt api version kubernetese awx.ansible.com awx-demo notepad yaml yml minikube kubectl apply get pod app.kubernetes.io get svc -list redhat.png

Create AWX instance on the K8S cluster by applying awx-demo.yml file. Provide it some time to get it created and check with pods and services command to verify, its created as below.

minikube kubectl -- apply -f awx-demo.yml
awx.awx.ansible.com/awx-demo created

minikube kubectl -- get pods -l "app.kubernetes.io/managed-by=awx-operator"
NAME                  READY   STATUS              RESTARTS   AGE
awx-demo-postgres-0   0/1     ContainerCreating   0          69s

minikube kubectl -- get svc -l "app.kubernetes.io/managed-by=awx-operator"
NAME                TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
awx-demo-postgres   ClusterIP   None             <none>        5432/TCP       11m
awx-demo-service    NodePort    10.102.150.189   <none>        80:30467/TCP   9m26s

Next you will require Nginx Controller in minikube environment, this will provide web server capability to connect to AWX server, for this use below yml kubernetes configuration template to apply to minikube. save it in notepad with command notepad awx-nginx-ingress.yml.

---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
  name: awx-nginx
spec:
  service_type: clusterip
  ingress_type: ingress
  hostname: my-awx.example.com

Apply the configuration using kubectl command.

minikube kubectl -- apply -f awx-nginx-ingress.yml
awx.awx.ansible.com/awx-nginx created

Microsoft Powershell Command prompt apiversion awx.ansible .com beta ansible awx nginx clusterip service ingress notepad yml yaml configuration minikube kubectl k8s awx-demo nginx postgres pods.png
Verify everything is getting created successfully, All looks good and it might take some time to create new pods and services.

minikube kubectl -- get awx
NAME        AGE
awx-demo    39m
awx-nginx   92s

minikube kubectl -- get pods -l "app.kubernetes.io/managed-by=awx-operator"
NAME                         READY   STATUS    RESTARTS   AGE
awx-demo-7bbb564887-kkgzx    4/4     Running   0          45m
awx-demo-postgres-0          1/1     Running   0          47m
awx-nginx-84f8565b87-kfq2r   0/4     Pending   0          9m45s
awx-nginx-postgres-0         1/1     Running   0          10m

All the information about kubernetes pods and services looks good, when I am trying to fetch it to view information.

minikube kubectl -- get pods -l "app.kubernetes.io/managed-by=awx-operator"
NAME                         READY   STATUS    RESTARTS   AGE
awx-demo-7bbb564887-kkgzx    4/4     Running   0          45m
awx-demo-postgres-0          1/1     Running   0          47m
awx-nginx-84f8565b87-kfq2r   0/4     Pending   0          9m45s
awx-nginx-postgres-0         1/1     Running   0          10m

minikube kubectl -- get svc -l "app.kubernetes.io/managed-by=awx-operator"
NAME                 TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
awx-demo-postgres    ClusterIP   None                     5432/TCP       48m
awx-demo-service     NodePort    10.102.150.189           80:30467/TCP   46m
awx-nginx-postgres   ClusterIP   None                     5432/TCP       10m
awx-nginx-service    ClusterIP   10.99.151.127            80/TCP         10m

minikube service list
|---------------|------------------------------------|--------------|-----------------------------|
|   NAMESPACE   |                NAME                | TARGET PORT  |             URL             |
|---------------|------------------------------------|--------------|-----------------------------|
| default       | awx-demo-postgres                  | No node port |
| default       | awx-demo-service                   | http/80      | http://192.168.32.128:30467 |
| default       | awx-nginx-postgres                 | No node port |
| default       | awx-nginx-service                  | No node port |
| default       | awx-operator-metrics               | No node port |
| default       | kubernetes                         | No node port |
| ingress-nginx | ingress-nginx-controller           | http/80      | http://192.168.32.128:30595 |
|               |                                    | https/443    | http://192.168.32.128:32271 |
| ingress-nginx | ingress-nginx-controller-admission | No node port |
| kube-system   | kube-dns                           | No node port |
|---------------|------------------------------------|--------------|-----------------------------|

Microsoft powershell cmd command prompt environment var minikube kubectl kubernetes k8s ansible awx awx-operator app.kubernetes.io awx-demo nginx postgres clusterip nodeport ingress kube-system node port ansible.png

This is few of the last crucial steps to know the IP address and port number to be used for Ansible AWX website url hosted on the minikube kubernetes. I am able to ping awx without any issues.

minikube service awx-demo-service --url
http://192.168.32.128:30467

ping 192.168.32.128

minikube kubectl -- get ingresses
NAME                CLASS    HOSTS                ADDRESS          PORTS   AGE
awx-nginx-ingress   <none>   my-awx.example.com   192.168.32.128   80      14m

Microsoft windows minikube service awx-demo-service url ping test-connection ansible tower awx kubectl kubernetes k8s containerization docker.png

I am able to connect to web url of Ansible AWX but don't have the password.

Ansible awx tower powershell kubernetes k8s docker vmware workstation vmrun vm-driver minikube run ansible awx redhat tower powershell microsoft windows 11 cmd.png

This is the final step to reveal and to know the password of Ansible AWX server. The password fetched with minikube command is in Base64 encoded format, to encode it and convert to normal text password, I am using below PowerShell command as below.

minikube kubectl -- get secret awx-demo-admin-password -o jsonpath="{.data.password}" 
RXV1YnB2Ymtub2txcWEzdVFkRDVsUkRzTlZNU3pqWHo=

powershell -command [Text.Encoding]::Utf8.GetString([Convert]::FromBase64String('RXV1YnB2Ymtub2txcWEzdVFkRDVsUkRzTlZNU3pqWHo='))
Euubpvbknokqqa3uQdD5lRDsNVMSzjXz

Microsoft cmd command prompt kubectl minikube -- get secret awx demo admin password jsonpath data frombase64string utf8 powershell encoding convert.png

Once I typed and tested the correct admin password and authentication is successful to awx server, it landed on to Ansible AWX DashBoard page.

kubernetes docker Ansible AWX tower dashboard jobs schedules templates credentials projects inventories hosts organizations users teams credentials types notification.png

Useful Articles
Getting started Ansible AWX tower for IT automation run first playbook
Ansible for VMwary Using vmware_vm_inventory dynamic inventory plugin
Ansible selectattr The error was TemplateRuntimeError no test named 'equalto'
ansible create an array with set_fact
Ansible get information from esxi advanced settings nested dictionary with unique keynames
Install Ansible AWX Tower on Ubuntu Linux
Ansible AWX installation error Cannot have both the docker-py and docker python modules
Ansible AWX installation error docker-compose run --rm --service-ports task awx-manage migrate --no-input
docker: Got permission denied while trying to connect to the Docker daemon socket
Ansible AWX Tower create Manual SCM (Source Control Credential Type) project
Reset Ansible AWX Tower admin password

Go Back



Comment

Blog Search

Page Views

6346828

Follow me on Blogarama