diff --git a/build_ansible.sh b/build_ansible.sh index f8cca48..b58dd0f 100644 --- a/build_ansible.sh +++ b/build_ansible.sh @@ -50,6 +50,9 @@ 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 @@ -61,7 +64,7 @@ exit fi # build playbook, retrieve roles and add variables to roles -mkdir /ansible/roles/ +mkdir -p /ansible/roles/ mkdir -p /ansible/new/roles mkdir -p /ansible/prev/roles # delete roles from previous attempt to update them @@ -76,12 +79,12 @@ echo "- hosts: $fqdn while read line do elements=() - for element in $(echo $line | tr ":" "\n"); do elements+=("$e");done + for e in $(echo $line | tr ":" "\n"); do elements+=("$e");done case ${elements[0]} in "role") # format role:role name:branch/tag to use # clone role repo from specific tag/branch w/o history - git clone -b ${elements[2]} --depth 1 https://git.actcur.com/actcur-ansible/role-${element[1]}.git:/ansible/new/${element[0]} + git clone -b ${elements[2]} --depth 1 https://git.actcur.com/actcur-ansible/role-${elements[1]}.git /ansible/new/roles/${elements[1]} # verify branch was cloned successfully count=`ls /new/$role/ | wc -l` @@ -89,7 +92,7 @@ do echo "issue grabbing role $role - dir/file count less than 9, exiting" exit fi - mv /tmp/roles/${element[0]} /ansible/new/roles + mv /tmp/roles/${elements[0]} /ansible/new/roles echo " - nginx-ssl" >> /ansible/new/$fqdn.yml # retrieve var file if it exists @@ -98,7 +101,7 @@ do # 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 ${element[0]} role on $fqdn - either file is invalid or download filed, exiting" + echo "issue grabbing vars file for ${elements[0]} role on $fqdn - either file is invalid or download filed, exiting" exit fi ;; diff --git a/playbook_templates/privtorrents.actcur.com b/playbook_templates/privtorrents.actcur.com index 9c28172..e343d7e 100644 --- a/playbook_templates/privtorrents.actcur.com +++ b/playbook_templates/privtorrents.actcur.com @@ -1,5 +1,5 @@ -role:deluge:branch:testing -role:nginx-ssl:branch:testing -role:certbot:branch:testing +role:deluge:testing +role:nginx-ssl:testing +role:certbot:testing # end of file \ No newline at end of file