Ansible
Ansible
https://www.ansible.com/webinars-training
https://www.ansible.com/resources/videos/quick-start-video?wvideo=qrqfj371b6
https://www.udemy.com/ansible-essentials-simplicity-in-automation/
Installation on server
useradd ansible -m
yum upgrade
yum install ansible
--Add all hosts into groups in /etc/ansible/hosts
Installation on hosts
useradd ansible -m
yum install sudo
echo "ansible ALL=(root) NOPASSWD: ALL" >> /etc/sudoers
--Add pub key from ansible control server to ansible user authorized_keys.
Test all hosts
su - ansible
ansible vboxs -m ping
-- Update OS
ansible vboxs -m yum -a "name=* state=latest" -b
[[:automation:ansible:yml|YML]]
Installing AWX On Centos 8.2
Build 8.2 on virtualbox (2cpu/4096mb +30gb disk)
http://mirrors.ukfast.co.uk/sites/ftp.centos.org/8.2.2004/isos/x86_64/CentOS-8.2.2004-x86_64-minimal.iso
If network is not on by default....set ONBOOT=yes in /etc/sysconfig/network-scripts/ifcfg-enp0s3
Create the following 2 scripts;
build1.bash
#!/usr/bin/env bash
sed -i '^SELINUX.*/SELINUX=disabled/' /etc/sysconfig/selinux
firewall-cmd --zone=public --add-masquerade --permanent
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
build2.bash
#!/usr/bin/env bash
yum install -y centos-release-ansible-29
yum install -y ansible yum-utils git python3
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce-3:18.09.1-3.el7
systemctl start docker ; systemctl enable docker
pip3 install docker ; pip3 install docker-compose
mkdir /var/lib/pgdocker /var/tmp/build
cd /var/tmp/build/
git clone -b 14.0.0 https://github.com/ansible/awx.git
cd awx/installer
sed -i 's/^postgres_data_dir.*/postgres_data_dir="\/var\/lib\/pgdocker"/' /var/tmp/build/awx/installer/inventory
Now run the first script;
bash build1.bash
reboot
Once the server has come up run
bash build2.bash
Now run the following;
cd /var/tmp/build/awx/installer
ansible-playbook -i inventory install.yml
Open the url to your server http://servernameorip:80
Login using admin/password
NOTE: Once the containers are up, it can take a few minutes for various task completions. Therefore the page may take a while to load and inform you of upgrades in progress.
Upgrading AWX
It's important to keep the inventory file from the installation as this will contain changes from the default installation.
You can run a diff on the original inventory against the new inventory file.
Any changes to the default can be written to a file called vars.yml and placed in awx/installer/
Check the version you wish to upgrade to. https://github.com/ansible/awx/releases
cd /var/tmp/build/
mv awx awx_old
git clone -b 14.0.0 https://github.com/ansible/awx.git
cd awx/installer
[ copy your vars file to here ]
ansible-playbook -i inventory install.yml -e @vars.yml
That's it! Sit back and wait.
Troubleshooting
If any errors appear from the ansible-playbook run, take a look at the awx_task container logs.
docker logs -f awx_task
If the logs show connection failures, try restarting all the containers;
docker restart $(docker ps -q)