testing #1
1 changed files with 10 additions and 11 deletions
|
@ -50,9 +50,6 @@ if $regrab;then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# install/update dependencies
|
|
||||||
pacman -Sy git --noconfirm
|
|
||||||
|
|
||||||
fqdn=`hostnamectl hostname`
|
fqdn=`hostnamectl hostname`
|
||||||
curl -k "https://git.actcur.com/actcur-ansible/playbook-builder/raw/branch/$branch/playbook_templates/$fqdn" -H "accept: application/raw" -o /tmp/$fqdn
|
curl -k "https://git.actcur.com/actcur-ansible/playbook-builder/raw/branch/$branch/playbook_templates/$fqdn" -H "accept: application/raw" -o /tmp/$fqdn
|
||||||
|
|
||||||
|
@ -71,7 +68,7 @@ mkdir -p /ansible/prev/roles
|
||||||
rm -r /ansible/new/roles/*
|
rm -r /ansible/new/roles/*
|
||||||
|
|
||||||
# create base playbook
|
# create base playbook
|
||||||
echo "- hosts: $fqdn
|
echo "- hosts: localhost
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
roles:" > /ansible/new/$fqdn.yml
|
roles:" > /ansible/new/$fqdn.yml
|
||||||
|
@ -92,16 +89,15 @@ do
|
||||||
echo "issue grabbing role $role - dir/file count less than 9, exiting"
|
echo "issue grabbing role $role - dir/file count less than 9, exiting"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
echo " - nginx-ssl" >> /ansible/new/$fqdn.yml
|
echo " - ${elements[1]}" >> /ansible/new/$fqdn.yml
|
||||||
|
|
||||||
# retrieve var file if it exists
|
# retrieve var file if it exists
|
||||||
curl -k "https://git.actcur.com/actcur-ansible/playbook-builder/raw/branch/$branch/var_files/${elements[1]}/$fqdn" -H "accept: application/raw" -o /ansible/new/roles/${element[1]/vars/main.yml
|
curl -k "https://git.actcur.com/actcur-ansible/playbook-builder/raw/branch/$branch/var_files/${elements[1]}/$fqdn" -H "accept: application/raw" -o /tmp/main.yml
|
||||||
|
# /ansible/new/roles/${elements[1]}/vars/main.yml
|
||||||
# verifty file was downloaded successfully
|
# verifty file was downloaded successfully
|
||||||
count=`grep -P "(---)|(end of file)" /tmp/build_ansible.sh | wc -l`
|
count=`grep -P "(---)|(end of file)" /tmp/main.yml | wc -l`
|
||||||
if [ "$count" != "2" ];then
|
if [ "$count" == "2" ];then
|
||||||
echo "issue grabbing vars file for ${elements[0]} role on $fqdn - either file is invalid or download filed, exiting"
|
mv /tmp/main.yml /ansible/new/roles/${elements[1]}/vars/main.yml
|
||||||
exit
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
"#*")
|
"#*")
|
||||||
|
@ -118,4 +114,7 @@ mv /ansible/$fqdn.yml /ansible/prev/
|
||||||
mv /ansible/roles/ /ansible/prev
|
mv /ansible/roles/ /ansible/prev
|
||||||
mv /ansible/new/* /ansible/
|
mv /ansible/new/* /ansible/
|
||||||
|
|
||||||
|
cd /ansible
|
||||||
|
ansible-playbook ${fqdn}.yml
|
||||||
|
|
||||||
# end of build_ansible.sh
|
# end of build_ansible.sh
|
Loading…
Add table
Reference in a new issue