Skip to content

Commit

Permalink
fix azure terraform ansible option
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayfly277 committed Jan 30, 2024
1 parent aaab557 commit 2ded022
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion goad.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ JOB=
PROVIDERS="virtualbox vmware azure proxmox"
LABS=$(ls -A ad/ |grep -v 'TEMPLATE')
TASKS="check install start stop status restart destroy disablevagrant enablevagrant"
ANSIBLE_PLAYBOOKS="build.yml ad-servers.yml ad-parent_domain.yml ad-child_domain.yml ad-members.yml ad-trusts.yml ad-data.yml ad-gmsa.yml laps.yml ad-relations.yml adcs.yml ad-acl.yml servers.yml security.yml vulnerabilities.yml reboot.yml elk.yml"
ANSIBLE_PLAYBOOKS="edr.yml build.yml ad-servers.yml ad-parent_domain.yml ad-child_domain.yml ad-members.yml ad-trusts.yml ad-data.yml ad-gmsa.yml laps.yml ad-relations.yml adcs.yml ad-acl.yml servers.yml security.yml vulnerabilities.yml reboot.yml elk.yml"
METHODS="local docker"
ANSIBLE_ONLY=0
ANSIBLE_PLAYBOOK=
Expand Down Expand Up @@ -269,17 +269,29 @@ install_provisioning(){
esac
;;
"azure")

cd "ad/$lab/providers/$provider/terraform"
public_ip=$(terraform output -raw ubuntu-jumpbox-ip)
cd -

rsync -a --exclude-from='.gitignore' -e "ssh -o 'StrictHostKeyChecking no' -i $CURRENT_DIR/ad/$lab/providers/$provider/ssh_keys/ubuntu-jumpbox.pem" "$CURRENT_DIR/" goad@$public_ip:~/GOAD/

case $method in
"local")
if [ -z $ANSIBLE_PLAYBOOK ]; then
ssh -tt -o "StrictHostKeyChecking no" -i "$CURRENT_DIR/ad/$lab/providers/$provider/ssh_keys/ubuntu-jumpbox.pem" goad@$public_ip << EOF
cd /home/goad/GOAD/ansible
export ANSIBLE_COMMAND="ansible-playbook -i ../ad/$lab/data/inventory -i ../ad/$lab/providers/$provider/inventory"
../scripts/provisionning.sh
exit
EOF
else
ssh -tt -o "StrictHostKeyChecking no" -i "$CURRENT_DIR/ad/$lab/providers/$provider/ssh_keys/ubuntu-jumpbox.pem" goad@$public_ip << EOF
cd /home/goad/GOAD/ansible
ansible-playbook -i ../ad/$lab/data/inventory -i ../ad/$lab/providers/$provider/inventory $ANSIBLE_PLAYBOOK
exit
EOF
fi
print_azure_info
;;
*)
Expand Down

0 comments on commit 2ded022

Please sign in to comment.