anchor.diff:  MAINTAINER "magicalyak" <tom.gamull@gmail.com>
   
   # global environment settings
  -ENV SERVER_NAME=localhost \
  -    ADMIN_PASSWORD=changeme \
  -    ANSIBLE_TOWER_VER=latest
  +ENV SERVER_NAME localhost
  +ENV ADMIN_PASSWORD changeme
  +ENV ANSIBLE_TOWER_VER latest
   
   ADD ./inventory /opt/inventory
   ADD ./ansible-setup.service /opt/ansible-setup.service
  
positive.code: # set runtime options for ansibkle-setup
  RUN echo "Setting up ansible-setup service to run at boot" && \
      echo "# ansible-setup.env" > /opt/ansible-setup.env && \
      echo "SERVER_NAME=${SERVER_NAME}" >> /opt/ansible-setup.env && \
      echo "ANSIBLE_TOWER_VER=${ANSIBLE_TOWER_VER}" >> /opt/ansible-setup.env && \
      echo "ADMIN_PASSWORD=${ADMIN_PASSWORD}" >> /opt/ansible-setup.env && \
      cp /opt/ansible-setup.env /certs/ansible-setup.env
      chmod +x /docker-entrypoint.sh && \
      cp /opt/ansible-setup.service /etc/systemd/system/ansible-setup.service && \
      systemctl enable ansible-setup.service
  
negative.code:  yum -y install ansible sudo which wget && \
  
  # install Ansible Tower
   echo "Downloading the $ANSIBLE_TOWER_VER version of Ansible Tower" && \
   cd /opt && \
   wget http://releases.ansible.com/awx/setup/ansible-tower-setup-${ANSIBLE_TOWER_VER}.tar.gz && \
   echo "Configuring Ansible Tower for setup at boot" && \
   tar -xvf ansible-tower-setup-${ANSIBLE_TOWER_VER}.tar.gz && \
   rm -rf ansible-tower-setup-${ANSIBLE_TOWER_VER}.tar.gz && \
   mv ansible-tower-setup-* /opt/tower-setup && \
   mv -f /opt/inventory /opt/tower-setup/inventory && \ 
   cp /opt/tower-setup/inventory /opt/inventory && \
  
  # add passwords and fix locale issue
   sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/'  /etc/sudoers && \
   echo "Setting password to $ADMIN_PASSWORD" && \
   sed -i "s/changeme/$ADMIN_PASSWORD/g" /opt/tower-setup/inventory && \
   echo "Setting connection to $SERVER_NAME" && \
   echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts && \
   echo "Patching locale in postgresql install" && \
   sed -i "s/lc_/#lc_/g" /opt/tower-setup/roles/postgres/templates/postgresql.conf.j2 && \
   echo "Patching IPv6 check in nginx due to docker container" && \
   sed -i "s/ansible_all_ipv6_addresses/[]/g" /opt/tower-setup/roles/nginx/templates/nginx.conf && \
   echo "Patching journald to log to console for Docker logs" && \
   sed -i "s/#ForwardToConsole=no/ForwardToConsole=yes/g" /etc/systemd/journald.conf && \
   echo "Setting rebuild flag in /certs in case it isn't mapped" && \
   mkdir -p /certs/.deleteme && \
   touch /certs/.rebuild && \
  