X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=roles%2Fcommon%2Ffiles%2Fawsible.sh;h=e123c8278c478860b3b39d1263fe6847067119a8;hb=b5e9bcd445bae75ed93fb9f66c92ed632614758b;hp=00a9ec1ab0a5008629582ce74d0ac7cbec502827;hpb=407606adbe003d8f79ee3a45cca526eca68dbd54;p=awsible diff --git a/roles/common/files/awsible.sh b/roles/common/files/awsible.sh index 00a9ec1..e123c82 100644 --- a/roles/common/files/awsible.sh +++ b/roles/common/files/awsible.sh @@ -1,9 +1,15 @@ # configure environment with AWS info -export INSTANCE_ID=`curl -s http://169.254.169.254/latest/meta-data/instance-id` -export PUBLIC_HOSTNAME=`curl -s http://169.254.169.254/latest/meta-data/public-hostname` -export PUBLIC_IP=`curl -s http://169.254.169.254/latest/meta-data/public-ipv4` -export PRIVATE_IP=`curl -s http://169.254.169.254/latest/meta-data/local-ipv4` -export EC2_AZ=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone/` +export INSTANCE_ID=`curl -sf http://169.254.169.254/latest/meta-data/instance-id` +if ! export PUBLIC_HOSTNAME=`curl -sf http://169.254.169.254/latest/meta-data/public-hostname` +then + export PUBLIC_HOSTNAME='' +fi +if ! export PUBLIC_IP=`curl -sf http://169.254.169.254/latest/meta-data/public-ipv4` +then + export PUBLIC_IP='' +fi +export PRIVATE_IP=`curl -sf http://169.254.169.254/latest/meta-data/local-ipv4` +export EC2_AZ=`curl -sf http://169.254.169.254/latest/meta-data/placement/availability-zone/` TMP="${#EC2_AZ}" export EC2_REGION="${EC2_AZ:0:$TMP-1}" unset TMP