Install AWX on CentOS 7 with Docker



  • Did this write up because everything else I found online were outdated.

    I’m going to assume your starting from a CentOS 7 minimal install. It should have at least 2 cpu cores and 4GB RAM, tho I’d recommend more of each. Storage space wise, requirements call for at least 20GB, I went with 40GB.

    This guide was written using the AWX install instructions on github: https://github.com/ansible/awx/blob/devel/INSTALL.md

    In my case I did add in the XCP-ng guest tools as this is running on an XCP-ng server, but that shouldn’t affect anything in this guide.

    All of these commands need to be run as root. Add sudo at the start of each command, or start out with sudo su -

    Install some utilities I always like to have available.

    yum -y install nano epel-release git yum-cron
    yum -y install glances
    sed -i 's/no/yes/g' /etc/yum/yum-cron.conf
    systemctl enable --now yum-cron
    

    Make sure the network adapter starts on boot. I use static IP mapping through DHCP, so no IP config needs done here.

    sed -i 's/ONBOOT=no/ONBOOT=yes/g' /etc/sysconfig/network-scripts/ifcfg-eth0
    

    Add IP addresses for AWX server and guests to hosts file.

    echo "x.x.x.x awxhowto.travisdh1.net awxhowto" >> /etc/hosts
    echo "x.x.x.x xo.travisdh1.net xo" >> /etc/hosts
    echo "x.x.x.x nextcloud.travisdh1.net nextcloud" >> /etc/hosts
    

    Open http firewall port. Mine is behind a reverse proxy, so I don’t configure HTTPS here.

    firewall-cmd --permanent --add-service=http
    firewall-cmd --reload
    

    Start installing prerequisites. pip is needed for the docker python module, docker-compose, node and npm will not be the correct version from the repository, so we need to handle those ourselves.

    yum -y install ansible docker make automake python2-pip
    systemctl enable --now docker
    pip install --upgrade pip
    pip install docker-compose
    pip install docker
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
    source ~/.bashrc
    nvm install 8
    nvm use 8
    

    We should now have all the prerequisites installed, and the correct version of each. Now onto the actual AWX things.

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

    I don’t think the AWX branding is required, but I’ve always put it in.

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

    Create a directory to persist the PostgreSQL docker instance and update the config.

    mkdir /opt/postgresql
    sed -i 's:postgres_data_dir=/tmp/pgdocker:postgres_data_dir=/opt/postgresql:g' /root/awx/installer/inventory
    

    Tell the installer to build with the official logos.

    sed -i 's:awx_official=false:awx_official=true:g' /root/awx/installer/inventory
    

    Time to start the actual install

    cd installer
    ansible-playbook -i inventory install.yml
    

    That should be it. The web page will not be immediately available until some background processes finish. In order to check this progress use

    docker logs -f awx_task
    

    Look for:

    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)
    
    >>> <User: admin>
    >>> 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)
    

    You will need to get the default admin password changed asap. Which is admin/password.

    When done, you should be able to login and see:
    3f1efce0-5289-414d-9d50-886a0e75ace6-image.png



  • Reserved for nginx reverse proxy config.



  • Reserved for update process



  • @travisdh1

    +++

    Many thanks for this I never heard of this project, glad finally we have UI for either SS or Ansible



  • @Emad-R said in Install AWX on CentOS 7 with Docker:

    @travisdh1

    +++

    Many thanks for this I never heard of this project, glad finally we have UI for either SS or Ansible

    The AWX project is upstream project for Red Hat's Ansible Tower.

    https://www.ansible.com/products/awx-project/faq



  • @Pete-S said in Install AWX on CentOS 7 with Docker:

    @Emad-R said in Install AWX on CentOS 7 with Docker:

    @travisdh1

    +++

    Many thanks for this I never heard of this project, glad finally we have UI for either SS or Ansible

    The AWX project is upstream project for Red Hat's Ansible Tower.

    https://www.ansible.com/products/awx-project/faq

    Also has lots of Ansible playbooks available at https://galaxy.ansible.com/ to do all the things.



  • Hi Travisdh,

    Great article, i installed awx without a docker following this guide. Take a look at this link http://yallalabs.com/devops/how-to-install-ansible-awx-without-docker-centos-7-rhel-7/



  • @faudel said in Install AWX on CentOS 7 with Docker:

    Hi Travisdh,

    Great article, i installed awx without a docker following this guide. Take a look at this link http://yallalabs.com/devops/how-to-install-ansible-awx-without-docker-centos-7-rhel-7/

    ^^^ Kinda suspect, because:

    This blog accepts forms of cash advertising, sponsorship, paid insertions or other forms of compensation. Aside from that we also make money from affiliate links.



  • Be careful with AWX. I would not use it in production. There are still breaking database changes between versions. There is a migration tool but still. Last time I used it, there were breaking changes from week to week. I've found Jenkins to be more flexible anyway.