A reference for spinning up Ansible AWX on top of a Kubernetes environment
Install k3s with bash script
curl -sfL https://get.k3s.io | sh -
change permissions on k3s config file
sudo chown $USER:$USER /etc/rancher/k3s/k3s.yaml
validate status
kubectl get nodes
Start with installing kustomize
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
sudo mv kustomize /usr/local/bin/
create kustomize instructions for installing operator
cd /var/tmp/
vim kustomization.yaml
Make sure to specify a release version, I will be using 2.2.1 in this example:
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
# Find the latest tag here: https://github.com/ansible/awx-operator/releases
- github.com/ansible/awx-operator/config/default?ref=2.2.1
# Set the image tags to match the git version from above
images:
- name: quay.io/ansible/awx-operator
newTag: 2.2.1
# Specify a custom namespace in which to install AWX
namespace: awx
install operator
kustomize build . | kubectl apply -f -
wait for operator to be installed and running
kubectl get pods -n awx
create awx.yaml
vim awx.yaml
---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
name: awx
spec:
service_type: nodeport
# default nodeport_port is 30080
nodeport_port: 30080
add axw.yaml to kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
# Find the latest tag here: https://github.com/ansible/awx-operator/releases
- github.com/ansible/awx-operator/config/default?ref=2.2.1
- awx.yaml
# Set the image tags to match the git version from above
images:
- name: quay.io/ansible/awx-operator
newTag: 2.2.1
# Specify a custom namespace in which to install AWX
namespace: awx
kick off job to install awx
kustomize build . | kubectl apply -f -
watch the glorious logs
kubectl logs -f deployments/awx-operator-controller-manager -c awx-manager --namespace awx
grab password
kubectl get secret awx-admin-password -o jsonpath="{.data.password}" --namespace awx | base64 --decode
- SCM
- Network
- Vault
AWX Hello World
[email protected]:cdot65/Ansible-AWX-Hello-World.git
PAN Hello World
[email protected]:cdot65/pan-ansible-hello-world.git
name: "Palo Alto Networks"
image: ghcr.io/cdot65/ansible-ee-paloaltonetworks:dev
name: "Firewalls"
Group: "firewalls"
Hosts:
- aus-vfw-01:
ansible_host: 10.60.0.41
- hdq-vfw-01:
ansible_host: 10.60.0.41
Hello World: AWX
name: "Hello World: AWX"
playbook: "hello.yaml"
ee: none
inventory: "demo"
Hello World: PAN-OS
name: "Hello World: PAN-OS"
playbook: "ansible/panos.yaml"
ee: "palo alto networks"
inventory: "Firewalls"