ansible-gnu-corporate-works.../provision.sh

43 lines
731 B
Bash
Raw Normal View History

2017-08-31 21:22:57 +02:00
#!/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"
2017-08-31 21:22:57 +02:00
update()
{
sudo apt-get update
sudo apt-get install -y ${prereqs}
2017-08-31 21:22:57 +02:00
}
fetch_archive()
{
wget -O ${archive_file} ${remote_file_url}
}
run_playbook()
{
cd $1
sudo ansible-playbook playbook.yml
2017-08-31 21:22:57 +02:00
}
cleanup()
{
rm -rf ${archive_file}
rm -rf ${working_directory}
2017-08-31 21:22:57 +02:00
}
echo "Let's update repositories and install Ansible ..."
2017-08-31 21:22:57 +02:00
update
echo "Let's download archive ..."
fetch_archive
if [[ -f ${archive_file} ]]
then
echo "Let's go ... "
2017-08-31 21:22:57 +02:00
run_playbook ${working_directory}
cleanup
fi