diff --git a/scripts/create.sh b/scripts/create.sh index f99dd57..4891094 100644 --- a/scripts/create.sh +++ b/scripts/create.sh @@ -13,6 +13,7 @@ dhcp_dir="../../dhcp_files" mac=52:54:00:`openssl rand -hex 1`:`openssl rand -hex 1`:`openssl rand -hex 1` branch="prod" deflate="y" +ansible="y" #get variables numre='^[0-9]+$' @@ -36,6 +37,7 @@ while true; do read -p "Specify last segment of IP (defaults to next available): while true; do read -p "Specify branch of build_ansible to use (defult $branch): " v;if [ -z $v ]; then break;else branch=$v;break;fi;done while true; do read -p "Full path to extra disk to attach (if applicable, default none): " v;if [ -z $v ]; then break;else if ! [ -f $v ] ; then echo "error: file doesn't exist";else attach=$v;break;fi;fi;done while true; do read -p "Autodeflate memory on use y/n (default $deflate)? " v;if [ -z $v ]; then break;elif [ "$v" == "y" ];then break; elif [ "$v" == "n" ];then deflate=$v;break;else echo "error: select y or n";fi;done +while true; do read -p "Autorun ansible build script (default $ansible)? " v;if [ -z $v ]; then break;elif [ "$v" == "y" ];then break; elif [ "$v" == "n" ];then ansible=$v;break;else echo "error: select y or n";fi;done echo "" echo "Name: $name" @@ -50,6 +52,7 @@ echo "IP: $ip" echo "Branch: $branch" echo "Attach: $attach" echo "Deflate: $deflate" +echo "Run Ansible: $ansible" echo "" read -p "Is this correct (y/n)? " v;if [ "$v" != "y" ];then "Exiting, restart to reenter info"; exit;fi @@ -59,8 +62,6 @@ if [ -n $ip ]; then dhcp_opts+=" -i $ip";fi lname=`echo $name | tr '[:upper:]' '[:lower:]'` -if [[ "$path" -eq "default" ]];then path=/virtual/disks/${name}.qcow2;fi - img=`./shared_scripts/download_install_image.sh $variant` #update DHCP @@ -166,7 +167,9 @@ ssh -i $ssh_key_dir/id_arch_builder ${lname}.actcur.com "ansible-galaxy collecti # run ansible ssh -i $ssh_key_dir/id_arch_builder ${lname}.actcur.com "mkdir /ansible/; curl -k 'https://git.actcur.com/actcur-ansible/playbook-builder/raw/branch/$branch/build_ansible.sh' -H 'accept: application/raw' -o /ansible/build_ansible.sh;echo "$branch" > /ansible/branch;/bin/bash /ansible/build_ansible.sh" -ssh -i $ssh_key_dir/id_arch_builder ${lname}.actcur.com "/bin/bash /ansible/build_ansible.sh" +if [[ "$deflate" == "y" ]]; then + ssh -i $ssh_key_dir/id_arch_builder ${lname}.actcur.com "/bin/bash /ansible/build_ansible.sh" +fi ssh -i $ssh_key_dir/id_arch_builder ${lname}.actcur.com "git config --global user.email 'ejparker@actcur.com';git config --global user.name 'Beth Parker'"