Skip to content

Instantly share code, notes, and snippets.

@adamrushuk
Last active March 18, 2021 17:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamrushuk/b92f54b800002f968e8aa4da158610fb to your computer and use it in GitHub Desktop.
Save adamrushuk/b92f54b800002f968e8aa4da158610fb to your computer and use it in GitHub Desktop.
Ansible AWX installation scripts for blog post: https://adamrushuk.github.io/installing-ansible-awx-docker/
#!/bin/bash
# Installs Ansible AWX
echo "INFO: Started Installing Ansible AWX..."
# Install prereq: Docker SDK for Python
echo "INFO: Started Installing Docker SDK for Python..."
pip install docker
echo "INFO: Finished Installing Docker SDK for Python."
# Clone repo
ansible_git_folder="/root/awx/"
if [ ! -d "$ansible_git_folder" ]
then
echo "INFO: Cloning Ansible AWX repo..."
cd /root/
git clone https://github.com/ansible/awx.git
else
echo "INFO: Ansible AWX repo already exists...SKIPPING."
fi
# Copy (overwrite) inventory file from vagrant share
echo "INFO: Copying Ansible AWX Inventory file..."
\cp /vagrant/vagrant/scripts/inventory /root/awx/installer/inventory
# Run installer Playbook
echo "INFO: Running Ansible AWX install playbook..."
cd /root/awx/installer/
ansible-playbook -i inventory install.yml
echo "INFO: Finished Installing Ansible AWX."
echo "INFO: Confirm build by running 'docker ps' and 'docker logs -f awx_task'"
#!/bin/bash
# Install common utils
echo "INFO: Started Installing Extra Packages Repo and useful utils..."
yum -y install epel-release --enablerepo=extras
yum -y update
yum -y install tree git vim bash-completion
yum -y install python-pip
pip install pip --upgrade
echo "INFO: Finished Installing Extra Packages Repo and useful utils."
#!/bin/bash
# Installs Docker CE
echo "INFO: Started Installing Docker..."
# Remove older versions
yum -y remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine
# Set up repo
yum -y install yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# Install Docker
yum -y install docker-ce
# Start Docker and enable auto-start on boot
systemctl start docker
systemctl enable docker
# Check Docker status
systemctl status docker
# Check Docker version (was "Docker version 18.09.0, build 4d60db4" during testing)
docker -v
echo "INFO: Finished Installing Docker."
localhost ansible_connection=local ansible_python_interpreter="/usr/bin/env python"
[all:vars]
# by default the base will be used to search for ansible/awx_web and ansible/awx_task
dockerhub_base=ansible
# Common Docker parameters
awx_task_hostname=awx
awx_web_hostname=awxweb
postgres_data_dir=/var/lib/awx/pgdocker
host_port=80
# The name of the directory (here "awx") will be the prefix of the docker containers
docker_compose_dir=/var/lib/awx
# Set pg_hostname if you have an external postgres server, otherwise
# a new postgres service will be created
# pg_hostname=postgresql
pg_username=awx
pg_password=awxpass
pg_database=awx
pg_port=5432
# RabbitMQ Configuration
rabbitmq_password=awxpass
rabbitmq_erlang_cookie=cookiemonster
# This will create or update a default admin (superuser) account in AWX, if not provided
# then these default values are used
admin_user=admin
admin_password=password
# Whether or not to create preload data for demonstration purposes
create_preload_data=True
# AWX Secret key
# It's *very* important that this stay the same between upgrades or you will lose the ability to decrypt
# your credentials
secret_key=awxsecret
# AWX project data folder. If you need access to the location where AWX stores the projects
# it manages from the docker host, you can set this to turn it into a volume for the container.
project_data_dir=/var/lib/awx/projects
@techie2000
Copy link

@adamrushuk
Copy link
Author

The link at the top of the page to https://adamrushuk.github.io/ansible/docker/centos/installing-ansible-awx-docker/ does ot work. Should it be https://adamrushuk.github.io/installing-ansible-awx-docker/ ?

Thanks for reporting, I've updated the link. I think a change to the blog must've changed that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment