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" prereqs="curl wget ansible"
remote_file_url="https://github.com/paulbsd/ansible-gnu-corporate-workstation/archive/master.zip" remote_file_url="https://github.com/paulbsd/ansible-gnu-corporate-workstation/archive/master.zip"
tmp_dir="/tmp"
archive_file="/tmp/master.zip" archive_file="/tmp/master.zip"
working_directory="/tmp/ansible-gnu-corporate-workstation" working_directory="/tmp/ansible-gnu-corporate-workstation-master"
update() update()
{ {
@ -14,12 +15,14 @@ update()
fetch_archive() fetch_archive()
{ {
wget -O ${archive_file} ${remote_file_url} wget -O ${archive_file} ${remote_file_url}
unzip -o -d /tmp /tmp/master.zip
} }
run_playbook() run_playbook()
{ {
cd $1 cd ${working_directory}
sudo ansible-playbook playbook.yml sudo ansible-playbook -i hosts playbook.yml
cd ${tmp_dir}
} }
cleanup() cleanup()
@ -34,9 +37,10 @@ update
echo "Let's download archive ..." echo "Let's download archive ..."
fetch_archive fetch_archive
echo "Let's extract the archive ..."
if [[ -f ${archive_file} ]] if [[ -f ${archive_file} ]]
then then
echo "Let's go ..." echo "Let's go ..."
run_playbook ${working_directory} run_playbook ${working_directory} && cleanup
cleanup
fi fi