Ansible AWX
Getting started with Ansible Tower
While ansible playbooks are great, sometimes they’re kind of high overhead. Getting tower up and running was a bit of a pain for me traditionally, and the support for kubernetes seemed lacking (at the time of writing).
Until I found the AWX operator. Leveraging the Operator Framework, the operator will manage installation of ansible on kubernetes for you. All you need is a simple, declarative tower config.
Prerequisites
- A running kubernetes cluster. Minikube is fine if you’re just testing locall.
Installation
Traditionally the installation is accomplished through ansible playbooks, but the operator keeps things simple. Under the covers it’s running ansible, but we don’t need to worry about workstation setup or creation of vm’s when we use k8s.
NOTE: In the example below, I’m using openshift.
- Create a namespace for tower.
k create ns awx
- Deploy the tower operator.
# Download the tower operator file.
curl -L -O https://raw.githubusercontent.com/ansible/awx-operator/devel/deploy/awx-operator.yaml
# Change the namespace to our default openshift-operators namespace
sed -i '.bak' 's/namespace:\ default/namespace:\ openshift-operators/g' awx-operator.yaml
# deploy.
kubectl apply -f awx-operator.yaml
- Deploy the tower instance.
- Create a file called
tower.yaml
with the below contents.
--- apiVersion: awx.ansible.com/v1beta1 kind: AWX metadata: name: tower namespace: awx spec: deployment_type: awx tower_admin_user: your-admin-user tower_admin_email: cloud-admin@red8.com tower_admin_password: your-admin-pass tower_broadcast_websocket_secret: your-difficult-pass tower_ingress_type: Route
- If you’re on vanilla k8s, change the ingress type as shown.
spec: ... tower_ingress_type: Ingress tower_hostname: awx.mycompany.com
- Create a file called
- Deploy tower.
kubectl apply -f tower.yaml
- Done.