43 lines
731 B
Bash
Executable File
43 lines
731 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"
|
|
archive_file="/tmp/master.zip"
|
|
working_directory="/tmp/ansible-gnu-corporate-workstation"
|
|
|
|
update()
|
|
{
|
|
sudo apt-get update
|
|
sudo apt-get install -y ${prereqs}
|
|
}
|
|
|
|
fetch_archive()
|
|
{
|
|
wget -O ${archive_file} ${remote_file_url}
|
|
}
|
|
|
|
run_playbook()
|
|
{
|
|
cd $1
|
|
sudo ansible-playbook playbook.yml
|
|
}
|
|
|
|
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
|
|
|
|
if [[ -f ${archive_file} ]]
|
|
then
|
|
echo "Let's go ... "
|
|
run_playbook ${working_directory}
|
|
cleanup
|
|
fi
|