AWX up and running – Upstream project of Ansible Tower

AWX is Open source version of Anisble Tower and it is an Upstream project for Ansible Tower.

AWX gives a web-based user interface, job scheduling, inventory management, reporting, workflow automation, credential sharing, and tooling to enable delegation

Installation of AWX:

We can install the AWX in Linux machine by three different methods,

1) Based on OpenShift
2) Based on Kubernetes
3) Based on Docker or Docker Compose

Here, we are going to use Docker based AWX installation on Linux server (ansible-controller/192.168.0.31)

Pre-requisite to install AWX on Docker based set up is as follows,

Ansible Requires Version 2.4+
Docker
docker-py Python module
GNU Make
Git Requires Version 1.8.4+
Node 6.x LTS version
NPM 3.x LTS

Ansible is installed and running with below version,

[root@ansible-controller ~]# ansible --version
ansible 2.5.5
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Apr 11 2018, 07:36:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
[root@ansible-controller ~]#

 

Docker is installed and running with below version,

[root@ansible-controller ~]# docker --version
Docker version 17.09.0-ce, build afdb6d4
[root@ansible-controller ~]#

Creating directory structure for AWX repo,

[root@ansible-controller ~]# mkdir -p /opt/ansible/work/awx
[root@ansible-controller ~]# cd /opt/ansible/work/awx
[root@ansible-controller awx]#

 

Clone the AWX repo:
git clone https://github.com/ansible/awx.git .

[root@ansible-controller awx]# git clone https://github.com/ansible/awx.git .
Cloning into '.'...
remote: Counting objects: 169595, done.
remote: Compressing objects: 100% (50/50), done.
remote: Total 169595 (delta 25), reused 41 (delta 19), pack-reused 169526
Receiving objects: 100% (169595/169595), 196.18 MiB | 2.80 MiB/s, done.
Resolving deltas: 100% (131071/131071), done.
[root@ansible-controller awx]#

[root@ansible-controller awx]# pwd
/opt/ansible/work/awx
[root@ansible-controller awx]# ls
API_STANDARDS.md config DATA_MIGRATION.md docs INSTALL.md LICENSE.md manage.py nodemon.json README.md setup.cfg shippable.yml tox.ini
awx CONTRIBUTING.md DCO_1_1.md installer ISSUES.md Makefile MANIFEST.in pytest.ini requirements setup.py tools
[root@ansible-controller awx]#

Inventory file will be available in the ‘installer’ directory, please update it according to our requirements

[root@ansible-controller awx]# cd installer/
[root@ansible-controller installer]# ls
build.yml install.yml inventory roles
[root@ansible-controller installer]#

[root@ansible-controller installer]# cat inventory | grep -v ^#
localhost ansible_connection=local ansible_python_interpreter="/usr/bin/env python"
[all:vars]
dockerhub_base=ansible
dockerhub_version=latest
postgres_data_dir=/tmp/pgdocker
host_port=80
docker_compose_dir=/var/lib/awx
pg_username=awx
pg_password=awxpass
pg_database=awx
pg_port=5432
secret_key=awxsecret
[root@ansible-controller installer]#

Here, we are going to update

postgres_data_dir=/var/lib/pgdocker
Uncomment the line -> project_data_dir=/var/lib/awx/projects

Run the playbook to install AWX as below,

[root@ansible-controller installer]# pwd
/opt/ansible/work/awx/installer
[root@ansible-controller installer]# ls
build.yml install.yml inventory roles
[root@ansible-controller installer]# ansible-playbook -i inventory install.yml

[root@ansible-controller installer]# ansible-playbook -i inventory install.yml

PLAY [Build and deploy AWX] ********************************************************************************************************************************************

TASK [check_vars : include_tasks] **************************************************************************************************************************************
skipping: [localhost]

TASK [check_vars : include_tasks] **************************************************************************************************************************************
included: /opt/ansible/work/awx/installer/roles/check_vars/tasks/check_docker.yml for localhost

TASK [check_vars : postgres_data_dir should be defined] ****************************************************************************************************************
ok: [localhost] => {
“changed”: false,
“msg”: “All assertions passed”
}

TASK [check_vars : host_port should be defined] ************************************************************************************************************************
ok: [localhost] => {
“changed”: false,
“msg”: “All assertions passed”
}

TASK [image_build : Get Version from checkout if not provided] *********************************************************************************************************
skipping: [localhost]

TASK [image_build : Set global version if not provided] ****************************************************************************************************************
skipping: [localhost]

………………….

………………….

………………….

………………….

………………….

………………….

………………….

………………….
TASK [local_docker : Activate AWX Web Container] ***********************************************************************************************************************
changed: [localhost]

TASK [local_docker : Activate AWX Task Container] **********************************************************************************************************************
changed: [localhost]

TASK [local_docker : Create /var/lib/awx directory] ********************************************************************************************************************
skipping: [localhost]

TASK [local_docker : Create docker-compose.yml file] *******************************************************************************************************************
skipping: [localhost]

TASK [local_docker : Start the containers] *****************************************************************************************************************************
skipping: [localhost]

PLAY RECAP *************************************************************************************************************************
localhost : ok=12 changed=5 unreachable=0 failed=0

[root@ansible-controller installer]#

Accessing AWX:

AWX has been installed in server (ansible-controller/192.168.0.31), we can access it via below URL,

http://192.168.0.31/

or

http://ansible-controller/

It will prompt you to enter user-name and password,

we can use default user-name: admin and password: password to login to AWX web console

Login Page:

AWX Console:

 

In AWX server,  five different containers will be running as below,

1) awx_task
2) awx_web
3) memcached
4) awx_rabbitmq
5) postgres

[root@ansible-controller ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
13fcb8871d51 ansible/awx_task:latest "/tini -- /bin/sh ..." 23 minutes ago Up 23 minutes 8052/tcp awx_task
9aca447c970b ansible/awx_web:latest "/tini -- /bin/sh ..." 23 minutes ago Up 23 minutes 0.0.0.0:80->8052/tcp awx_web
6784f7274ffc memcached:alpine "docker-entrypoint..." 28 minutes ago Up 28 minutes 11211/tcp memcached
bb4d40e490d8 ansible/awx_rabbitmq:3.7.4 "docker-entrypoint..." 28 minutes ago Up 28 minutes 4369/tcp, 5671-5672/tcp, 15671-15672/tcp, 25672/tcp rabbitmq
bc9601a70e48 postgres:9.6 "docker-entrypoint..." 28 minutes ago Up 28 minutes 5432/tcp postgres
[root@ansible-controller ~]#

 

Now AWX is up and running in server (ansible-controller/192.168.0.31).

Please refer below URLs for more details,
Ref:
https://github.com/ansible/awx
https://github.com/ansible/awx/blob/devel/INSTALL.md

 

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: