Adding more code for Exchange

This commit is contained in:
Chris Long
2021-03-29 20:50:01 -07:00
parent bf502e85c9
commit 553f9a13c5
12 changed files with 170 additions and 27 deletions

View File

@@ -2,17 +2,17 @@
# Replace the x's with the IP addresses from "terrafrom output"
dc:
hosts:
13.77.149.92:
x.x.x.x:
wef:
hosts:
13.66.251.74:
y.y.y.y:
win10:
hosts:
13.66.225.219:
z.z.z.z:
exchange:
hosts:
52.183.7.185:
#exchange:
# hosts:
# w.w.w.w:

View File

@@ -23,6 +23,7 @@ TF_OUTPUT=$(terraform output)
DC_IP=$(echo "$TF_OUTPUT" | grep -E -o "dc_public_ip = ([0-9]{1,3}[\.]){3}[0-9]{1,3}" | cut -d '=' -f 2 | tr -d ' ')
WEF_IP=$(echo "$TF_OUTPUT" | grep -E -o "wef_public_ip = ([0-9]{1,3}[\.]){3}[0-9]{1,3}" | cut -d '=' -f 2 | tr -d ' ')
EXCHANGE_IP=$(echo "$TF_OUTPUT" | grep -E -o "exchange_public_ip = ([0-9]{1,3}[\.]){3}[0-9]{1,3}" | cut -d '=' -f 2 | tr -d ' ')
WIN10_IP=$(echo "$TF_OUTPUT" | grep -E -o "win10_public_ip = ([0-9]{1,3}[\.]){3}[0-9]{1,3}" | cut -d '=' -f 2 | tr -d ' ')
# Code needs to be added for exchange
@@ -39,5 +40,10 @@ fi
echo "Replacing the default values in DetectionLab/Azure/Ansible/inventory.yml..."
sed -i.bak "s/x.x.x.x/$DC_IP/g; s/y.y.y.y/$WEF_IP/g; s/z.z.z.z/$WIN10_IP/g" ../Ansible/inventory.yml
if [ -z $EXCHANGE_IP ]; then
echo "Found Exchange IP address in Terraform output. Adding to inventory."
sed -i.bak "s/#exchange:/exchange:/g; s/# hosts:/ hosts:/g; s/# w.w.w.w:/ $EXCHANGE_IP/g" ../Ansible/inventory.yml
fi
echo "Displaying the updated inventory.yml below!"
cat ../Ansible/inventory.yml