update
This commit is contained in:
parent
1a6356a44a
commit
6526d7bf2b
1 changed files with 10 additions and 11 deletions
|
@ -50,9 +50,6 @@ if $regrab;then
|
|||
exit
|
||||
fi
|
||||
|
||||
# install/update dependencies
|
||||
pacman -Sy git --noconfirm
|
||||
|
||||
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
|
||||
|
||||
|
@ -71,7 +68,7 @@ mkdir -p /ansible/prev/roles
|
|||
rm -r /ansible/new/roles/*
|
||||
|
||||
# create base playbook
|
||||
echo "- hosts: $fqdn
|
||||
echo "- hosts: localhost
|
||||
become: true
|
||||
|
||||
roles:" > /ansible/new/$fqdn.yml
|
||||
|
@ -92,16 +89,15 @@ do
|
|||
echo "issue grabbing role $role - dir/file count less than 9, exiting"
|
||||
exit
|
||||
fi
|
||||
echo " - nginx-ssl" >> /ansible/new/$fqdn.yml
|
||||
echo " - ${elements[1]}" >> /ansible/new/$fqdn.yml
|
||||
|
||||
# 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
|
||||
count=`grep -P "(---)|(end of file)" /tmp/build_ansible.sh | wc -l`
|
||||
if [ "$count" != "2" ];then
|
||||
echo "issue grabbing vars file for ${elements[0]} role on $fqdn - either file is invalid or download filed, exiting"
|
||||
exit
|
||||
count=`grep -P "(---)|(end of file)" /tmp/main.yml | wc -l`
|
||||
if [ "$count" == "2" ];then
|
||||
mv /tmp/main.yml /ansible/new/roles/${elements[1]}/vars/main.yml
|
||||
fi
|
||||
;;
|
||||
"#*")
|
||||
|
@ -118,4 +114,7 @@ mv /ansible/$fqdn.yml /ansible/prev/
|
|||
mv /ansible/roles/ /ansible/prev
|
||||
mv /ansible/new/* /ansible/
|
||||
|
||||
cd /ansible
|
||||
ansible-playbook ${fqdn}.yml
|
||||
|
||||
# end of build_ansible.sh
|
Loading…
Add table
Reference in a new issue