Installing AWX on CRC on your laptop

In my current project engagement I’m working with Ansible Tower which is a great tool for automating operational tasks using Ansible playbooks.

However, I was interested in getting Ansible Tower up an running on my laptop using OpenShift for some personal education.

Ansible Tower and OpenShift are very cool tools — but also a bit too expensive for just playing around. Luckily there are upstream open source projects for both tools:

  • AWX is the upstream open source project of Ansible Tower
  • OKD is the upstream open source project of OpenShift

However, as the hardware requirements for OKD are still too high for my laptop, I decided to use CRC (Cloud Ready Containers), which is the free OpenShift development environment provided by RedHat.

Finally I was successful, and just if anybody else is interested here are the steps install this setup.

First of all you need a bit of hardware (at least 4 vCPUs, 8 GB memory and 32 GB free space) and a RedHat Developer account to download CRC. My setup is 8 vCPUs, 32 GB memory and enough free space on hard disk. Also I’m using Fedora 33 (which is the open source upstream project for RedHat Enterprise Linux) as operating system.

The high level overview (seems so easy):

  • Install Ansible engine
  • Download and install CRC (I was using v1.20)
  • Clone AWX repo and prepare installation files
  • Install AWX (I was using v15.0.0)

[Hint: just check the comments for this story — I have also added instructions for how to install actual AWX version using AWX Operator on CRC.]

The detailed steps:

  1. Install Ansible (needed to install AWX — how cool is that!) using sudo dnf install ansible
  2. Install CRC — for this just follow the instructions provided by CRC download page

Hint: in CRC v1.20 there is an issue with wildcard DNS setup on Fedora 33. A workaround for this are the following commands (before installing CRC):

sudo resolvectl domain crc ~testing
sudo resolvectl dns crc 192.168.130.11
sudo resolvectl default-route crc false

After downloading the CRC binary and pull secret, you need to trigger two commands: crc setupand crc start. Below you can see how the output looks after successful invocation.

Output of crc setup:

Output of crc start:

Before continuing with AWX installation, ensure that you can login as developer using both CRC UI and oc CLI.

3. Clone the AWX repo (ensure to choose a released version like 15.0.0)

git clone -b 15.0.0 https://github.com/ansible/awx.git

Then just follow the AWX installation instructions for OpenShift (Minishift, which is the previous version of CRC). When preparing the inventory you need to enable the following parameters:

openshift_host=https://api.crc.testing:6443
openshift_project=awx
openshift_user=developer
openshift_skip_tls_verify=True
openshift_pg_emptydir=True

The last step is to run the install playbook (that’s why we need to install Ansible previously):

ansible-playbook -i inventory \
install.yml \
-e openshift_password=developer \
-e docker_registry_password=$(oc whoami -t)

Result of successful playbook run (which takes some time):

In CRC you should see two pods up and running in the awxproject.

In the end AWX can be accessed using https://awx-web-svc-awx.apps-crc.testing URL. You can login using admin_userand admin_passwordfrom AWX inventory file.

Troubleshooting

In case of errors during CRC (or AWX) setup it was helpful to have fresh CRC setup again. For this you need to trigger the following commands.

crc stop
crc delete
crc cleanup
crc setup
crc start

Also, in case CRC is up an running, but the AWX playbook is failing, you can start the playbook again after fixing the issue.

Conclusion

These steps are an easy and free way to setup Ansible Tower on your laptop. The advantage to use AWX instead of Ansible Tower with trial license is that all the features are available and there are no limitations on the number of managed hosts. Of course this setup is not recommended for production environment.

--

--

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
Torsten Schäfer

Torsten Schäfer

Father, husband, supporter of Eintracht Frankfurt, interested in IT