Get AWX running on your Mac
WTF is AWX?
AWX is the free, open source version of Ansible Tower. Owned by Red Hat, Ansible is a configuration management tool for keeping your infrastructure in a desired state. Like Fedora is the upstream OS for RHEL, AWX is the upstream project for Ansible Tower. AWX is a central interface for managing all your ansible hosts and inventory in one place.
Why in the god damn shit would I want to use that?
Do you like consistent, repeatable, infrastructure deploys? Do you hate logging onto machines carrying out tedious tasks? Do you cry at the thought of running yum update everywhere? Of course you do. Why else would you be reading a DevOps article? You’re not here for my starling wit.
Ansible is just one of many configuration management tools you can use to achieve this. They all work in a similar fashion. You define a state for your infrastructure in a file. The config management tool then takes your defined state and ensures your servers match that state. If it finds the state has differed, it will correct it.
For example, let’s say you have a coworker who has decided the default text editor on all 350 of your VM’s should be Midnight Commander*. Why? Because he likes it and fuck the other 7 people on the team. After you’ve hidden his body under the server room floor, you’re going to want an easy way to unfuck that mess. Config management tools will do that for you. What they won’t do is solve the age old argument over which text editor is best to begin with, but no-one thinks it’s Midnight Commander.
*Yes, this actually happened, and I fixed it with Puppet.
Which config management should you choose? It 👏 doesn’t 👏 matter.👏 Use whatever one you like best that you can easily work with. There is no right or wrong tool and anyone who says so is full of shit (Midnight Commander notwithstanding). The end result is what’s important, not the tool, and the end result we want here is consistency and repeatability.
So once you have your tool, you want a way to centrally manage it and easily view your estate from one place. If you’ve chosen Ansible, then AWX is what you need.
OK fine, how do I get it?
To get started, you will need to install:
I had all of these running, so I haven’t included how to do that here, but links are above. It’s not a difficult task, so go do that and come back here.
Firstly, go to the AWX repo and find the latest release number. You need to clone this into your working directory.
git clone -b 01.02.03 https://github.com/ansible/awx.git
Next, install the python libraries you need using pip. You want docker, docker-compose, and awxkit.
pip install docker docker-compose awxkit
Now install ansible itself using Brew.
brew install ansible
Once that’s done, install ansible-galaxy to manage community roles and collections.
brew install ansible-galaxy
Do a quick check that Ansible is installed. A version command should respond.
Now onto the meat and bones. Go back into the directory you cloned the AWX repo into, and go to the installer folder.
Inside this directory is a file called
inventory which contains the settings for AWX. These are the values you need to set. Some of these will be predefined, you can keep those if you want, but do not do that outside of your local machine.
Now, the final step, running the ansible playbook that will install AWX. Ensure you’re still in
awx/installer and run:
ansible-playbook -i inventory install.yml
Then watch it go!
When it completes, Docker should have created containers for you. Check this by running
docker ps and you should see something like this
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e562a4cb0f7c ansible/awx:17.0.0 "/usr/bin/tini -- /u…" 4 days ago Up 34 hours 8052/tcp awx_task
19b14ff53390 ansible/awx:17.0.0 "/usr/bin/tini -- /b…" 4 days ago Up 34 hours 0.0.0.0:80->8052/tcp awx_web
52f2cf0f33e7 redis "docker-entrypoint.s…" 4 days ago Up 34 hours 6379/tcp awx_redis
1793d1836b51 postgres:12 "docker-entrypoint.s…" 4 days ago Up 34 hours 5432/tcp awx_postgres
Look for the
awx_web container, and you will see the local IP address AWX is listening on. Open that in a browser, in my case it was on 0.0.0.0:80
The login credentials are the
admin_password values that you configured earlier in the inventory file. Log in with them.
You then have your AWX dashboard ready to go.
And there you go, AWX is now running on your Mac without a load of fuss and hassle. Go reward yourself with a nice cup of tea, you’ve earned it!