Get started using Ansible AWX (Open Source Tower version) in one minute

Since yesterday's announcement that Ansible had released the code behind Ansible Tower, AWX, under an open source license, I've been working on an AWX Ansible role, a demo AWX Vagrant VM, and an AWX Ansible Container project.

As part of that last project, I have published two public Docker Hub images, awx_web and awx_task, which can be used with a docker-compose.yml file to build AWX locally in about as much time as it takes to download the Docker images:

curl -O https://raw.githubusercontent.com/geerlingguy/awx-container/master/docker-compose.yml
docker-compose up -d

After docker-compose is finished, wait a couple minutes for the initial database migration to run, then you should be able to access AWX at http://localhost/ (the default login is admin/password):

Ansible AWX Dashboard - after initialization - with Angry Potato

You can find out all the details as to how this works, and how you can build the Docker images yourself using Ansible Container in the project repository: AWX (Built with Ansible Container).

Comments

Trying your images but it seems to fail and on the PostgreSQL docker console all i see is the following repeated (MACOS laptop runnign stable docker) )

ERROR:  relation "conf_setting" does not exist at character 158
STATEMENT:  SELECT "conf_setting"."id", "conf_setting"."created", "conf_setting"."modified", "conf_setting"."key", "conf_setting"."value", "conf_setting"."user_id" FROM "conf_setting" WHERE ("conf_setting"."user_id" IS NULL AND
...
"main_schedule"."next_run" DESC

@Nick - Usually this just means the initial database migration hasn't completed yet. It takes 5-10 minutes after setup is complete, and until that time, if you access the home page, you'll see a 500 error and signin attempts will fail.

Check the logs of the awx_task container instead, and see if it's still running the migration.

Trying your images but it just show "CANCEL OK × OK working... "

docker logs awx_task_1 showed that the initialization process seems completed

Applying social_auth.0003_alter_email_max_length... OK
Applying social_auth.0004_auto_20160423_0400... OK
Applying social_auth.0005_auto_20160727_2333... OK
Applying sso.0001_initial... OK
Applying sso.0002_expand_provider_options... OK
Python 2.7.5 (default, Nov 6 2016, 00:28:07)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)

>>>
>>> Default organization added.
Demo Credential, Inventory, and Job Template added.
Successfully registered instance awx
(changed: True)
Creating instance group tower
Added instance awx to tower
(changed: True)
2017-09-11 04:13:55,336 CRIT Supervisor running as root (no user in config file)
2017-09-11 04:13:55,336 WARN For [program:awx-celeryd-beat], redirect_stderr=true but stderr_logfile has also been set to a filename, the filename has been ignored
2017-09-11 04:13:55,342 INFO RPC interface 'supervisor' initialized
2017-09-11 04:13:55,342 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2017-09-11 04:13:55,342 INFO supervisord started with pid 90
2017-09-11 04:13:56,345 INFO spawned: 'celery' with pid 93
2017-09-11 04:13:56,346 INFO spawned: 'channels-worker' with pid 94
2017-09-11 04:13:56,347 INFO spawned: 'callback-receiver' with pid 95
2017-09-11 04:13:56,348 INFO spawned: 'awx-celeryd-beat' with pid 96
2017-09-11 04:13:57,351 INFO success: celery entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-09-11 04:13:57,351 INFO success: channels-worker entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-09-11 04:13:57,351 INFO success: callback-receiver entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-09-11 04:13:57,351 INFO success: awx-celeryd-beat entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
^C

You probably need to wait a bit longer for all the migrations to finish. Also, try opening a different browser after the 5-10 minute period (you'll know when your CPU goes down to idle again). Sometimes the browser caches that weird unformatted page and doesn't seem to be able to pick up the actual rendered page once the web container actually starts working correctly.

Another option that also works is to docker-compose stop and then start (again, after the initial database migration is complete).

Hmm, I'm having the same issue now and my CPU usage has gone down. Getting 404s on all the CSS and JS files. Tried it a few times now. Other suggestions?

In the image itself, nginx.conf is pointing to /var/lib/awx/public/static/ for static,
but all of the content is at /usr/lib/python2.7/site-packages/awx/ui/static/

Hello Jeff,

Very good documented. I used this URL https://github.com/geerlingguy/awx-container to build all the container. When I try to run the sudo -E ansible-playbook -i 'localhost,' -c local prebuild.yml I'm getting the following error.

TASK [Build base web image] **********************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Error building awx_web - code: None, message: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers), logs: [u'Step 1/32 : FROM centos:7\\n']"}
to retry, use: --limit @/git/awx-container/prebuild/prebuild.retry

The server is behind a Proxy.
Can you please advise?

Jeff, I used docker-compose to install awx, I have two problems. First it seems stuck at "AWX is upgrading or install" and second, I'm only able to access via localhost using elinks. Any help would be appreciated. thanks

Jeff, I'm having a heck of a time. Two things, first I can only get to awx via localhost (http://localhost), but then I only get the message "AWX is currently upgrading or installing, this page will refresh when done" Well, it never get done. Please help.

thanks

Great work ! thanks for supplying the containers. Runs fine but a bit slow.

Is it possible to speed things up ?

thanks

Is there any yaml file(s) for kubernetes deployment from you.

Or, if you can give me an idea on disabling the login page. That would be helpful.
I tried to disable by adding property
AUTH_BASIC_ENABLED = False
at /etc/tower/settings.py in both awx_task/awx_web pods but no use.

Hey Jeff,

I found this tutorial interesting. What I haven't quite been able to work out is how to bring up an AWX installation without using containers or openshift. I have put together a small cluster with vagrant and installed ansible. Can you tell me what rpm needs to be installed for the GUI or what source to compile? Thanks

Dear Jeff, thank you very much for the job. This is amazing, I need only one docker-compose file and voilà: PostgreSQL, Rabit, Elasticsearch and AWX have found their living on my workstation. Yet your images `geerlingguy/awx_task` and `geerlingguy/awx_web` have never started there, so I've forever got AWX is upgrading. I waited for an hour and the migration didn't complete. I'm sorry.

I've changed the docker-compose.yml file placed the 'official' (I'm aware AWX has no official builds since the software isn't supported by RedHat) images there: `ansible/awx_web:latest` and `ansible/awx_web:latest`. It took nearly 15 minutes to migrate the database and now I'm able to login to AWX.

Nevertheless, as I noted at the beginning, thank you so much for your work, without this composer file I must have installed the required database and middleware step by step and wasted a lot of time.

Hey Jeff Geerling,
Thank you for this wonderful documentation.
I was able to launch this AWX tower, But i need to understand about the logs, where will i find the logs for this AWX tower
and how will i find the status of this AWX tower?
i have installed this using root user?
Do i need to install this with seperate user?
please help me sir

This is coming pretty late, so I assume you already have found an answer to your question, but for anyone else that finds their way here, this setup uses Docker containers to run AWX. If you aren't familiar with Docker, it is kind of a virtualization, or self contained images run on the parent OS. You probably don't need an in depth knowledge of Docker to get this to run, but it certainly helps to troubleshoot.

To look at the logs, you first need to find your containers. As root (or any user that is part of the docker group), you can run 'docker ps' to see your running containers. To look at the logs of a particular container as if you are tailing a log file, you need to do "docker logs -f ." That should get you started. Anything more in depth is really outside the scope of a comment section.

Hi, this seems to really be a great idea!
It's just a shame it doesn't work out of the box for me. Maybe you can give me a hand? It looks like I am getting a python exception in the two services aws_task and aws_web where those complain about a misconfigured/missing SECRET_KEY (which I haven't changed in the docker-compose.yml and checked it's there)

```awx_web_1 | 2020-03-24 17:28:30,671 INFO spawned: 'daphne' with pid 141
awx_task_1 | 2020-03-24 17:28:31,027 INFO gave up: dispatcher entered FATAL state, too many start retries too quickly
awx_web_1 | Traceback (most recent call last):
awx_web_1 | File "/var/lib/awx/venv/awx/bin/daphne", line 8, in
awx_web_1 | sys.exit(CommandLineInterface.entrypoint())
awx_web_1 | File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/daphne/cli.py", line 144, in entrypoint
awx_web_1 | cls().run(sys.argv[1:])
awx_web_1 | File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/daphne/cli.py", line 174, in run
awx_web_1 | channel_layer = importlib.import_module(module_path)
awx_web_1 | File "/var/lib/awx/venv/awx/lib64/python3.6/importlib/__init__.py", line 126, in import_module
awx_web_1 | return _bootstrap._gcd_import(name[level:], package, level)
awx_web_1 | File "", line 994, in _gcd_import
awx_web_1 | File "", line 971, in _find_and_load
awx_web_1 | File "", line 955, in _find_and_load_unlocked
awx_web_1 | File "", line 665, in _load_unlocked
awx_web_1 | File "", line 678, in exec_module
awx_web_1 | File "", line 219, in _call_with_frames_removed
awx_web_1 | File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/asgi.py", line 9, in
awx_web_1 | prepare_env() # NOQA
awx_web_1 | File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/__init__.py", line 95, in prepare_env
awx_web_1 | if not settings.DEBUG: # pragma: no cover
awx_web_1 | File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/conf/__init__.py", line 79, in __getattr__
awx_web_1 | self._setup(name)
awx_web_1 | File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/conf/__init__.py", line 66, in _setup
awx_web_1 | self._wrapped = Settings(settings_module)
awx_web_1 | File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/conf/__init__.py", line 176, in __init__
awx_web_1 | raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
awx_web_1 | django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
awx_web_1 | 2020-03-24 17:28:31,313 INFO exited: daphne (exit status 1; not expected)
awx_web_1 | 2020-03-24 17:28:32,314 INFO gave up: daphne entered FATAL state, too many start retries too quickly
```

I'm getting the same error as Giuseppe:

docker logs -f awx_task_1

Traceback (most recent call last):
File "/usr/bin/awx-manage", line 8, in
sys.exit(manage())
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/__init__.py", line 136, in manage
prepare_env()
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/__init__.py", line 95, in prepare_env
if not settings.DEBUG: # pragma: no cover
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/conf/__init__.py", line 79, in __getattr__
self._setup(name)
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/conf/__init__.py", line 66, in _setup
self._wrapped = Settings(settings_module)
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/conf/__init__.py", line 176, in __init__
raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
Traceback (most recent call last):
File "/usr/bin/awx-manage", line 8, in
sys.exit(manage())
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/__init__.py", line 136, in manage
prepare_env()
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/__init__.py", line 95, in prepare_env
if not settings.DEBUG: # pragma: no cover
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/conf/__init__.py", line 79, in __getattr__
self._setup(name)
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/conf/__init__.py", line 66, in _setup
self._wrapped = Settings(settings_module)
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/conf/__init__.py", line 176, in __init__
raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

Hello Jeff,
I have AWX running and then I started getting "Invalid username and/or password. Please try again."
I have tried to search and reinstall - but still I cannot login.
Do you how to recover a lost password or Where can I change the admin/password?
thanks Will