Ansible AWX Install
Install the free version of ansible tower
Prerequisites
Install single node K3s
Update Ubuntu:
sudo apt update && sudo apt -y upgrade
Install K3s: curl -sfL https://get.k3s.io | sudo bash -
Change permissions so user can access the kubectl config file:
sudo chmod 644 /etc/rancher/k3s/k3s.yaml
Validate K3s install: kubectl get nodes you should see it say that it is ready. If it says permission denied you may need to run with sudo
Make sure that git is installed: sudo apt update && sudo apt install git build-essential -y
Setup and install awx-operator
Clone the awx-operator git repo: git clone https://github.com/ansible/awx-operator.git
Create the namespace: export NAMESPACE=awx and kubectl create ns ${NAMESPACE}
Set current context: kubectl config set-context --current --namespace=$NAMESPACE
Switch to the awx-operator directory: cd awx-operator/
Make sure that curl is installed: sudo apt install curl jq -y
Save the latest version to an environment variable: RELEASE_TAG=`curl -s https://api.github.com/repos/ansible/awx-operator/releases/latest | grep tag_name | cut -d '"' -f 4 you can check the version by doing: echo $RELEASE_TAG
Checkout the current version: git checkout $RELEASE_TAG
Deploy the AWX operator: export NAMESPACE=awx then run: make deploy
Wait a few minutes then you should see the axw-operator pod by running: kubectl get pods
Create static persistant volume claim:
cat <<EOF | kubectl create -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: static-data-pvc
namespace: awx
spec:
accessModes:
- ReadWriteOnce
storageClassName: local-path
resources:
requests:
storage: 5Gi
EOF
Check to ensure pvc was created: kubectl get pvc -n awx this will say pending until it is bound to the pods
Create the deployment file: nano awx-deploy.yml or vim awx-deploy-yml paste the contents below into the file
---
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/projects
extra_volumes: |
- name: static-data
persistentVolumeClaim:
claimName: static-data-pvc
Apply the deployment file: kubectl apply -f awx-deploy.yml it should say "awx.awx.ansible.com/awx created"
You can watch the pods to see when the deployment is ready by using: watch kubectl get pods -l "app.kubernetes.io/managed-by=awx-operator" the pods whill say that the status is running when it is ready.
If you run kubectl get pvc it should say that it is bound now
The pvcs are store in /var/lib/rancher/k3s/storage/
Locate the node port used to access the web ui by running: kubectl get svc -l "app.kubernetes.io/managed-by=awx-operator" Then navigate to http://hostip:portnumber or to http://hostname:portnumber
Decode the admin password by running: 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}}'
Now you can login and configure to your liking