47 lines
869 B
Bash
Executable File
47 lines
869 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
prereqs="curl wget ansible"
|
|
remote_file_url="https://github.com/paulbsd/ansible-gnu-corporate-workstation/archive/master.zip"
|
|
tmp_dir="/tmp"
|
|
archive_file="/tmp/master.zip"
|
|
working_directory="/tmp/ansible-gnu-corporate-workstation-master"
|
|
|
|
update()
|
|
{
|
|
sudo apt-get update
|
|
sudo apt-get install -y ${prereqs}
|
|
}
|
|
|
|
fetch_archive()
|
|
{
|
|
wget -O ${archive_file} ${remote_file_url}
|
|
unzip -o -d /tmp /tmp/master.zip
|
|
}
|
|
|
|
run_playbook()
|
|
{
|
|
cd ${working_directory}
|
|
sudo ansible-playbook -i hosts playbook.yml
|
|
cd ${tmp_dir}
|
|
}
|
|
|
|
cleanup()
|
|
{
|
|
rm -rf ${archive_file}
|
|
rm -rf ${working_directory}
|
|
}
|
|
|
|
echo "Let's update repositories and install Ansible ..."
|
|
update
|
|
|
|
echo "Let's download archive ..."
|
|
fetch_archive
|
|
|
|
echo "Let's extract the archive ..."
|
|
|
|
if [[ -f ${archive_file} ]]
|
|
then
|
|
echo "Let's go ..."
|
|
run_playbook ${working_directory} && cleanup
|
|
fi
|