Role Detail

geerlingguy.awx-container

Ansible AWX container for Docker.
Downloads
8
Type Container App
Minimum Ansible Container Version 0.9.1
Installation $ ansible-container init geerlingguy.awx-container
Tags
awx
cd
ci
container
docker
tower
Last Commit 2017-10-23 02:24:02 AM UTC
Last Imported 2017-11-17 14:39:02 PM UTC
Version History
Version Release Date
1.0.4 2017-10-23 02:24:02 AM
1.0.3 2017-09-11 04:15:04 AM
1.0.2 2017-09-10 03:01:03 AM
1.0.1 2017-09-08 17:05:05 PM
1.0.0 2017-09-08 14:10:02 PM
Last 10 Imports
Completed Status
2017-11-17 14:39:02 PM UTC SUCCESS
2017-11-10 14:39:02 PM UTC SUCCESS
2017-11-03 14:37:02 PM UTC SUCCESS
2017-10-27 14:42:02 PM UTC SUCCESS
2017-10-23 01:26:01 AM UTC SUCCESS
2017-10-22 21:45:09 PM UTC SUCCESS
2017-10-22 21:36:09 PM UTC SUCCESS
2017-10-20 20:09:08 PM UTC SUCCESS
2017-10-20 14:30:02 PM UTC SUCCESS
2017-10-13 14:30:02 PM UTC SUCCESS

AWX (Built with Ansible Container)

Build Status

This project is in it's early stages. There will be bugs!

This project is composed of three main parts:

  • Ansible Container project: This project is maintained on GitHub: geerlingguy/awx-container. Please file issues, support requests, etc. against this GitHub repository.
  • Docker Hub Image: If you just want to use geerlingguy/awx_web and geerlingguy/awx_task in your project, you can pull it from Docker Hub.
  • Ansible Role: If you need an Ansible role to build AWX, check out geerlingguy.awx on Ansible Galaxy. (This is the Ansible role that does the bulk of the work in managing the AWX container.)

Versions

Currently maintained versions include:

  • geerlingguy/awx_web:
    • 1.x, latest: AWX 1.x
    • 1.0.1
  • geerlingguy/awx_task:
    • 1.x, latest: AWX 1.x
    • 1.0.1

Quickstart - Standalone Usage with Docker Compose

If you just want to get an AWX environment running quickly, you can use the docker-compose.yml file included with this project to build a local environment accessible on http://localhost:80/:

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

The Docker Compose file uses community images for postgres, rabbitmq, and memcached, and the following images for AWX:

After the initial database migration completes (this can take a few minutes; follow the progress with docker logs -f [id-of-awx_task-container]), you can able to access the AWX interface at http://localhost/. The default login is admin/password.

Management with Ansible Container

Prerequisites

Before using this project to build and maintain AWX images for Docker, you need to have the following installed:

Build the AWX images

Typically, you would build the images as specified in the container.yml file using ansible-container --var-file config.yml build, but in this case, since there are many dependencies bundled in the AWX repository, we will build the Docker images using a helper playbook:

$ cd prebuild/
$ ansible-galaxy install -r requirements.yml
$ ansible-playbook -i 'localhost,' -c local prebuild.yml

After this playbook runs, you should see two new Docker images (which we'll use in the Ansible Container definition):

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
awx_task            devel               26311794058d        29 seconds ago      938MB
awx_web             devel               3d38dccc9190        58 seconds ago      913MB

A Vagrantfile is included with this project to assist in building a clean environment with all the dependencies required to build the AWX images (in case you don't want to install everything on your local workstation!). To use it:

  1. Run vagrant up.
  2. Wait for Vagrant's provisioning to complete (it will run prebuild.yml automatically).
  3. Log in with vagrant ssh and use docker or ansible as needed.

Build the conductor

Build the conductor using ansible-container build:

ansible-container --var-file config.yml build

Note: If you get any permission errors trying to generate a Docker container, make sure you're either running the commands as root or with sudo, or your user is in the docker group (e.g. sudo usermod -G docker -a [user], then log out and log back in).

Note 2: Currently, some of the features used in this Ansible Container definition require installing ansible-container from source, instead of installing the current tagged release, 0.9.1.

Run the containers

ansible-container --var-file config.yml run

You should be able to reach AWX by accessing http://localhost/ in your browser.

(Use stop to stop the container, and destroy to reset the containers and all images.)

Push the containers to Docker Hub

Currently, the process for updating this image on Docker Hub is manual. Eventually this will be automated via Travis CI using ansible-container push (currently, this is waiting on this issue to be resolved).

  1. Log into Docker Hub on the command line:

    docker login --username=geerlingguy
    
  2. Tag the latest version (only if this is the latest/default version):

    docker tag [web image id] geerlingguy/awx_web:latest
    docker tag [web image id] geerlingguy/awx_web:1.x
    docker tag [task image id] geerlingguy/awx_task:latest
    docker tag [task image id] geerlingguy/awx_task:1.x
    
  3. Push tags to Docker Hub:

    docker push geerlingguy/awx_web:latest # (if this was just tagged)
    docker push geerlingguy/awx_web:1.x
    [etc...]
    

License

MIT / BSD

Author Information

This container build was created in 2017 by Jeff Geerling, author of Ansible for DevOps.

version: "2"
settings:
  conductor_base: centos:7

services:
  postgres:
    from: "postgres:9.6"
    roles: []
    environment:
      - "POSTGRES_USER={{ pg_username }}"
      - "POSTGRES_PASSWORD={{ pg_password }}"
      - "POSTGRES_DB={{ pg_database }}"

  rabbitmq:
    from: "rabbitmq:3"
    roles: []
    environment:
      - "RABBITMQ_DEFAULT_VHOST=awx"

  memcached:
    from: "memcached:alpine"
    roles: []

  awx_web:
    from: "awx_web:{{ awx_repo_version }}"
    ports:
      - "{{ awx_host_port }}:8052"
    hostname: awxweb
    links:
      - rabbitmq
      - memcached
      - postgres
    environment:
      - "SECRET_KEY={{ awx_secret_key }}"
      - "DATABASE_USER={{ pg_username }}"
      - "DATABASE_PASSWORD={{ pg_password }}"
      - "DATABASE_NAME={{ pg_database }}"
      - "DATABASE_PORT={{ pg_port }}"
      - "DATABASE_HOST=postgres"
      - "RABBITMQ_USER=guest"
      - "RABBITMQ_PASSWORD=guest"
      - "RABBITMQ_HOST=rabbitmq"
      - "RABBITMQ_PORT=5672"
      - "RABBITMQ_VHOST=awx"
      - "MEMCACHED_HOST=memcached"
      - "MEMCACHED_PORT=11211"

  awx_task:
    from: "awx_task:{{ awx_repo_version }}"
    links:
      - rabbitmq
      - memcached
      - awx_web:awxweb
      - postgres
    hostname: awx
    environment:
      - "SECRET_KEY={{ awx_secret_key }}"
      - "DATABASE_USER={{ pg_username }}"
      - "DATABASE_PASSWORD={{ pg_password }}"
      - "DATABASE_NAME={{ pg_database }}"
      - "DATABASE_HOST=postgres"
      - "DATABASE_PORT={{ pg_port }}"
      - "RABBITMQ_USER=guest"
      - "RABBITMQ_PASSWORD=guest"
      - "RABBITMQ_HOST=rabbitmq"
      - "RABBITMQ_PORT=5672"
      - "RABBITMQ_VHOST=awx"
      - "MEMCACHED_HOST=memcached"
      - "MEMCACHED_PORT=11211"

registries:
  docker:
    url: https://docker.io
    namespace: geerlingguy
    repository_prefix: ''