Last active
January 20, 2018 15:31
-
-
Save rahulroshan96/946c35a4991c7a14b0b1663c2bda830c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -x | |
userfile="/var/lib/cloud/instance/user-data.txt" | |
if [ -e $userfile ]; then #if file is present | |
resourceGroup=$(curl -H Metadata:true "http://169.254.169.254/metadata/instance/compute/resourceGroupName?api-version=2017-08-01&format=text") | |
sudo sed -e 's/AVI-RESOURCE-GROUP/$resourceGroup/g' $userfile > $userfile | |
sudo cat $userfile | |
sudo reboot | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment