Installing AWX on MacOS

Get AWX running on your Mac

The AWX logo. Good isn’t it?

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.

ansible --version

Now onto the meat and bones. Go back into the directory you cloned the AWX repo into, and go to the installer folder.

cd awx/installer

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.

dockerhub_base=ansible
awx_task_hostname=awx
awx_web_hostname=awxweb
postgres_data_dir="~/.awx/pgdocker"
host_port=80
host_port_ssl=443
docker_compose_dir="~/.awx/awxcompose"
pg_username=awxuser
pg_password=hunter2
pg_database=awx
pg_port=5432
admin_user=awx-admin
admin_password=thepasswordyouwant
awx_alternate_dns_servers="8.8.8.8,8.8.4.4"
create_preload_data=True
secret_key=imnottellingyou

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_user and admin_password values that you configured earlier in the inventory file. Log in with them.

The AWX login screen
The AWX login screen
SUCCESS!

You then have your AWX dashboard ready to go.

Screenshot of the AWX dashboard
Screenshot of the AWX dashboard
Hooray!

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!

Dean likes your work

DevOps Rascal. Obsessed with stickers. Neato mom. AWS certified SysOps associate. She/her.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store