fixed bugs

This commit is contained in:
Paul 2017-08-31 23:43:52 +02:00
parent 5eeaba3fd2
commit 747ec4d942
2 changed files with 11 additions and 6 deletions

1
hosts Normal file
View File

@ -0,0 +1 @@
localhost ansible_connection=local

View File

@ -2,8 +2,9 @@
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"
working_directory="/tmp/ansible-gnu-corporate-workstation-master"
update()
{
@ -14,12 +15,14 @@ update()
fetch_archive()
{
wget -O ${archive_file} ${remote_file_url}
unzip -o -d /tmp /tmp/master.zip
}
run_playbook()
{
cd $1
sudo ansible-playbook playbook.yml
cd ${working_directory}
sudo ansible-playbook -i hosts playbook.yml
cd ${tmp_dir}
}
cleanup()
@ -34,9 +37,10 @@ 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
run_playbook ${working_directory} && cleanup
fi