#!/usr/bin/env bash prereqs="curl wget ansible" remote_file_url="https://git.paulbsd.com/paulbsd/ansible-gnu-corporate-workstation/archive/master.zip" tmp_dir="/tmp" archive_file="/tmp/ansible-gnu-corporate-workstation-master.zip" working_directory="/tmp/ansible-gnu-corporate-workstation" playbook_file="playbook.yml" update() { sudo apt-get update sudo apt-get install -y ${prereqs} } fetch_archive() { wget -O ${archive_file} ${remote_file_url} unzip -o -d ${tmp_dir} ${archive_file} } run_playbook() { cd ${working_directory} sudo ansible-playbook -i hosts ${playbook_file} 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 && cleanup fi