How to install Ansible AWX on centos 7

Ansible Tower (formerly ‘AWX’) is a web-based solution that makes Ansible even more easy to use for IT teams of all kinds. It’s designed to be the hub for all of your automation tasks.

Tower allows you to control access to who can access what, even allowing sharing of SSH credentials without someone being able to transfer those credentials. Inventory can be graphically managed or synced with a wide variety of cloud sources. It logs all of your jobs, integrates well with LDAP, and has an amazing browsable REST API. Command line tools are available for easy integration with Jenkins as well. Provisioning callbacks provide great support for autoscaling topologies.

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is the upstream project for Tower, a commercial derivative of AWX.

Prerequisites

Before you can run a deployment, you’ll need the following installed in your local environment:

System Requirements

The system that runs the AWX service will need to satisfy the following requirements

  • At least 4GB of memory
  • At least 2 cpu cores
  • At least 20GB of space
  • Running Docker, Openshift, or Kubernetes
  • If you choose to use an external PostgreSQL database, please note that the minimum version is 10+.

Installation steps:

1. Install Dependencies

yum install -y epel-release

yum remove python-docker-py

yum install -y yum-utils device-mapper-persistent-data lvm2 ansible git python-devel python-pip python-docker-py vim-enhanced

pip install cryptography
pip install jsonschema
pip install docker-compose~=1.23.0
pip install docker –upgrade

2. Install docker

Configure docker ce stable repository.

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

Installing docker.

yum install docker-ce -y

Start docker service.

systemctl start docker

Enable docker service.

systemctl enable docker

3. Deploy AWX

Clone AWX repo

git clone https://github.com/ansible/awx.git

Clone commercial logos

cd awx/

git clone https://github.com/ansible/awx-logos.git

Configure AWX

cd installer/

$ vim inventory

awx_official=true

Deploy AWX

ansible-playbook -i inventory install.yml -vv

Check the status

docker ps -a

AWX is ready and can be accessed from the browser.

http://ipaddress:80/

the default username is “admin” and the password is “password”.

Final checks:

  1. verify whether the service is started or not with ss -tlnp | grep 80
  2. make sure your firewall is open for port 80
  3. make sure your OS is using python 3.6+ and pip3

References:

https://github.com/ansible/awx/blob/devel/INSTALL.md

20 thoughts on “How to install Ansible AWX on centos 7”

  1. The Feb. 2020 updated procedure would be:

    yum remove python-docker-py
    pip install cryptography
    pip install jsonschema
    pip install docker-compose~=1.23.0
    pip install docker –upgrade
    # You can now run the playbook
    # On CentOS 7 you’ve got to open the firewall too
    firewall-cmd –zone=public –add-port=80/tcp –permanent
    firewall-cmd –reload

      1. No problem 😉 Anyway, “Ansible Tower (formerly ‘AWX’) ” is not correct. Ansible AWX is the upstream version of Ansible Tower – means – AWX is the community edition.
        Just like CentOS and RHEL (or just like any other RedHat Enterprise product with its Community edition)

      2. Thank you for the document, I was installing it and as an update the steps that I had to do to make it work.

        yum install -y epel-release
        yum remove python-docker-py
        yum install -y yum-utils device-mapper-persistent-data lvm2 ansible git python-devel python-pip python-docker-py vim-enhanced

        1. Disable SELinux
        setenforce 0
        vi /etc/sysconfig/selinux
        SELINUX=disabled
        sestatus

        2.
        pip install cryptography
        pip install jsonschema
        pip install docker-compose~=1.23.0
        pip install docker –upgrade

        2. Install docker
        Configure docker ce stable repository.

        yum-config-manager –add-repo https://download.docker.com/linux/centos/docker-ce.repo

        – Installing docker.

        yum install docker-ce -y
        Start docker service.
        systemctl start docker
        – Enable docker service.
        systemctl enable docker

        – Install Python 3
        yum install python3 python36-docker -y
        pip3 install docker-compose

        3. Deploy AWX
        Clone AWX repo

        git clone https://github.com/ansible/awx.git

        Clone commercial logos

        cd awx/

        git clone https://github.com/ansible/awx-logos.git

        Configure AWX

        cd installer/

        $ vim inventory
        awx_official=true

        localhost ansible_connection=local ansible_python_interpreter=”/usr/bin/python3″

        Deploy AWX
        ansible-playbook -i inventory install.yml -vv
        Check the status
        docker ps -a
        AWX is ready and can be accessed from the browser.
        http://ipaddress:80/

  2. Hi, I follow the steps. on “pip install docker –upgrade” I get an error message saying docker-compose 1.23.2 has requirement docker 4.0 but you’ll have docker 4.2. then running the installer playbook, it fails saying “Failed to import the required Python library (Docker SDK) on localhost. Please advise.

    1. TLDR; Install as root and if logging in as an unprivileged user use ‘su -‘

      Replying to my own comment. It seems I caused the problem myself by SSHing in as my own user then switching to root (with su rather than su -) so the AWX installer saved some config files under /home/jonny/.aws/axscompose but then moved on to creating the remaining contents under /root/.awx/awxcompose so when the containers started some of the config files were missing so the volumes in the docker compose were created as directories rather than files but of course there was no config content.

      1. Great job on that thing you did @johny.
        TLDR; Install as root and if logging in as an unprivileged user use ‘su -‘

  3. Hi everyone! I have the following trouble with the last step:

    TASK [local_docker : Start the containers] *******************************************************************************************************************************************************
    task path: /root/awx/installer/roles/local_docker/tasks/compose.yml:39
    fatal: [localhost]: FAILED! => {“changed”: false, “errors”: [], “module_stderr”: “Starting awx_web … \nHost is already in use by another container\n\u001b[1A\u001b[2K\nStarting awx_web … \n\u001b[1B”, “module_stdout”: “”, “msg”: “Error starting project Encountered errors while bringing up the project.”}

    CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
    66fc7e85ac26 ansible/awx:13.0.0 “tini — /bin/sh -c …” 7 hours ago Created awx_web
    f93cc983ab3b postgres:10 “docker-entrypoint.s…” 7 hours ago Up 3 minutes 5432/tcp awx_postgres
    57267ac481ec redis “docker-entrypoint.s…” 7 hours ago Up 3 minutes 6379/tcp awx_redis

    1. seems like there is already an aws container is running…
      you can stop all running containers with
      docker stop $(docker ps -aq)
      and then rerun playbook.

    1. getting error while install playbook

      fatal: [localhost]: FAILED! => {“changed”: false, “errors”: [], “module_stderr”: “”, “module_stdout”: “Trying to pull repository docker.io/library/redis … \n”, “msg”: “Error starting project Get https://registry-1.docker.io/v2/: dial tcp 34.228.211.243:443: connect: connection refused”}

  4. getting error while install playbook

    fatal: [localhost]: FAILED! => {“changed”: false, “errors”: [], “module_stderr”: “”, “module_stdout”: “Trying to pull repository docker.io/library/redis … \n”, “msg”: “Error starting project Get https://registry-1.docker.io/v2/: dial tcp 34.228.211.243:443: connect: connection refused”}

  5. —-could you please help me with this error?

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

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

    TASK [Gathering Facts] *************************************************************************************************************
    fatal: [localhost]: FAILED! => {“ansible_facts”: {}, “changed”: false, “failed_modules”: {“setup”: {“failed”: true, “module_stderr”: “/usr/bin/env: python3: No such file or directory\n”, “module_stdout”: “”, “msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”, “rc”: 127}}, “msg”: “The following modules failed to execute: setup\n”}

    PLAY RECAP *************************************************************************************************************************
    localhost : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

    [root@centos7 installer]#

    -Docker is Running.

    [root@centos7 ~]# systemctl enable docker
    Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

    [root@centos7 ~]# systemctl status docker
    â—� docker.service – Docker Application Container Engine
    Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
    Active: active (running) since Sun 2020-09-06 04:45:20 UTC; 44s ago
    Docs: http://docs.docker.com
    Main PID: 1532 (dockerd-current)
    CGroup: /system.slice/docker.service
    ├─1532 /usr/bin/dockerd-current –add-runtime docker-runc=/usr/libexec/docker/docker-runc-current –default-runtime=do…
    └─1545 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock –metrics-int…

    Sep 06 04:45:19 centos7 dockerd-current[1532]: time=”2020-09-06T04:45:19.906672982Z” level=warning msg=”Docker could not en…ystem”
    Sep 06 04:45:19 centos7 dockerd-current[1532]: time=”2020-09-06T04:45:19.935201401Z” level=info msg=”Graph migration to con…conds”
    Sep 06 04:45:19 centos7 dockerd-current[1532]: time=”2020-09-06T04:45:19.936058581Z” level=info msg=”Loading containers: start.”
    Sep 06 04:45:20 centos7 dockerd-current[1532]: time=”2020-09-06T04:45:20.077597010Z” level=info msg=”Firewalld running: false”
    Sep 06 04:45:20 centos7 dockerd-current[1532]: time=”2020-09-06T04:45:20.246261411Z” level=info msg=”Default bridge (docker…dress”
    Sep 06 04:45:20 centos7 dockerd-current[1532]: time=”2020-09-06T04:45:20.307628249Z” level=info msg=”Loading containers: done.”
    Sep 06 04:45:20 centos7 dockerd-current[1532]: time=”2020-09-06T04:45:20.324019711Z” level=info msg=”Daemon has completed i…ation”
    Sep 06 04:45:20 centos7 dockerd-current[1532]: time=”2020-09-06T04:45:20.324139460Z” level=info msg=”Docker daemon” commit=…1.13.1
    Sep 06 04:45:20 centos7 dockerd-current[1532]: time=”2020-09-06T04:45:20.330828761Z” level=info msg=”API listen on /var/run….sock”
    Sep 06 04:45:20 centos7 systemd[1]: Started Docker Application Container Engine.
    Hint: Some lines were ellipsized, use -l to show in full

    -Ansible Version,

    [root@centos7 installer]# ansible –version
    ansible 2.9.10
    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 2 2020, 13:16:51) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

  6. I’m seeing this for a longtime ,~45 mins after I did http://:80/

    [root@xxxx installer]# ss -tlnp | grep 80
    LISTEN 0 128 [::]:80 [::]:* users:((“docker-proxy”,pid=18436,fd=4))
    [root@xxxx installer]# python -V
    Python 3.6.9
    [root@xxxx installer]#

  7. [local_docker : Start the containers] ********************************************************************************************
    task path: /home/mukeshkumar/awx/installer/roles/local_docker/tasks/compose.yml:39
    fatal: [localhost]: FAILED! => {“changed”: false, “msg”: “Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)) on imp02test’s Python /usr/bin/python3. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter, for example via pip install docker or pip install docker-py (Python 2.6). The error was: No module named ‘requests'”}
    PLAY RECAP ****************************************************************************************************************************
    localhost : ok=12 changed=1 unreachable=0 failed=1 skipped=91 rescued=0 ignored=0

Leave a Reply

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