Skip to content

Instantly share code, notes, and snippets.

@dougbtv
Last active November 26, 2018 20:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dougbtv/7f40de4aa49e7f2f6ff452a30517ce94 to your computer and use it in GitHub Desktop.
Save dougbtv/7f40de4aa49e7f2f6ff452a30517ce94 to your computer and use it in GitHub Desktop.
AWX -- Upstream Tower install notes

Ansible tower!???? OPENSOURCE!

Alright, let's see what we can do here with awx -- the upstream opensource ansible tower

We're working with the install guide

I spin up a VM in my case... You can copycat my VM spinup method I borrowed from this blog post if you want. But at any rate, these steps are done on a CentOS 7 host.

[root@droctagon2 ~]# ./spinup.sh ansibletower

And ssh to it

ssh -i ~/.ssh/id_testvms centos@192.168.1.37

Install git, we'll need that install other utilities you might use, too.

[centos@ansibletower ~]$ sudo yum install -y git

And you need epel

[centos@ansibletower ~]$ sudo yum install -y epel-release

But, don't get too far ahead of yourself, make sure your other packages are up to date.

[root@ansibletower centos]# yum update -y

Welp, that's just the tip of the iceberg, they say you need:

  • Ansible
  • gettext
  • Docker
  • docker-py Python module
  • Node 6.x LTS version
  • NPM 3.x LTS

And! ...OpenShift. Well if you go that way. We're going to just use the docker method, I read too far too fast in the docs and originally thought it required OpenShift.

So let's start with the pre-requisites for OpenShift AIO cluster to get docker installed. Luckily I have a OpenShift AIO cheat sheet that I based this on. It's probably overkill, but, it's half the battle if you'll later try it with OpenShift.

# Set ip_forward to 1
/sbin/sysctl -w net.ipv4.ip_forward=1

# Install docker (plus a handy wget)
yum install -y docker wget

# Setup docker to allow an "insecure" registry.
sed -i -e "s|\# INSECURE_REGISTRY='--insecure-registry'|INSECURE_REGISTRY='--insecure-registry 172.30.0.0/16'|" /etc/sysconfig/docker

# Start and enable docker.
systemctl daemon-reload
systemctl start docker
systemctl enable docker

Now, what about node, are the RPMs good enough? Lemme guess, they're in EPEL. Let's just go ahead and install npm, cause that will also get us node. Then we can see what we got....

Nope, bummer. There's mad dependency issues with Nodejs packages at the moment, so we're going to have to do it by hand. Not that much fun, folks.

$ wget https://nodejs.org/dist/v6.11.3/node-v6.11.3-linux-x64.tar.xz
$ cp node-v6.11.3-linux-x64/bin/* /usr/bin
$ node --version
$ mkdir /usr/lib/nodejs
$ tar -xJvf node-v6.11.3-linux-x64.tar.xz -C /usr/lib/nodejs
$ mv /usr/lib/nodejs/node-v6.11.3-linux-x64/ /usr/lib/nodejs/node-v6.11.3/
$ export NODEJS_HOME=/usr/lib/nodejs/node-v6.11.3/
$ export PATH=$NODEJS_HOME/bin:$PATH
$ node -v
$ npm version
$ echo "export NODEJS_HOME=/usr/lib/nodejs/node-v6.11.3/ && export PATH=$NODEJS_HOME/bin:$PATH" >> .bashrc

And give it to root, too...

[root@ansibletower installer]# tail -n1 /home/centos/.bashrc >> ~/.bashrc

Great, so, that should satisfy the above reqs for Node.

Phew, we have packages for the other deps, so, grab up those...

[root@ansibletower centos]# yum install -y ansible docker-python gettext

You're getting closer.

But, oh, the sighs. Your docker images can't modify things in mounts cause selinux. Let's try to fix that without disabling selinux. I got a little help from this issue and this great atomic article by the highly touted Dan Walsh.

So let's make the dir we're going to mount postgres to.

[root@ansibletower installer]# mkdir -p /tmp/pgdocker
[root@ansibletower installer]# chcon -R -t svirt_sandbox_file_t /tmp/pgdocker/

Installing with the Docker method

There's a docker method.

We need some more things... oh yes, yes we do. NPM uses these during the builds.

[root@ansibletower installer]# yum install -y gcc gcc-c++ bzip2

Clone it.

[root@ansibletower centos]# git clone --depth 50 https://github.com/ansible/awx.git

Give ourselves a key -- this might not exactly be necessary. But, ansible uses a local install, so I just did this out of muscle memory.

[root@ansibletower centos]# ssh-keygen -t rsa
[root@ansibletower centos]# cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys 
[root@ansibletower centos]# ssh root@localhost

Get into the installer dir.

[root@ansibletower .]# cd awx/installer/

Check out the inventory if you want. You can customize some stuff, we're going to leave it default, for now, though.

[root@ansibletower installer]# cat inventory 

Now, run the playbook, dun... dun... DUNNNNNN.

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

Voila! ...Now what?

Wait for it all to come up.

[root@ansibletower installer]# docker logs -f awx_task

The 'migrations' that it runs take a particularly long time. So... wait on up for that.

If you see something like:

Creating instance group tower
Added instance awx to tower

You're all done.

Access the web UI!

And... You just go to http://yourhost/ and login as "admin" with password of "password"

final step.... pour a single malt.

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