From 6526d7bf2b90a96e85ad6d03b12beb7c31ae0b30 Mon Sep 17 00:00:00 2001 From: Beth Date: Sat, 5 Oct 2024 19:17:01 -0500 Subject: [PATCH] update --- build_ansible.sh | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/build_ansible.sh b/build_ansible.sh index 292a363..d116e18 100644 --- a/build_ansible.sh +++ b/build_ansible.sh @@ -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 \ No newline at end of file