Merge pull request #172 from AlexandreJean/master

Add the possibility for cyclecloud to be installed without public-ip
This commit is contained in:
Xavier Pillons 2020-02-27 12:47:35 -08:00 коммит произвёл GitHub
Родитель 908ebf5697 e28b75ae4c
Коммит 56c0486774
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 33 добавлений и 12 удалений

Просмотреть файл

@ -384,4 +384,9 @@ function build_hostlists
fi
done
read_value dns_prefix ".vnet.dns_domain" NOT-SET
if [ "$dns_prefix" != "NOT-SET" ]; then
find $tmp_dir/hostlists -type f | xargs sed -i "s/\$/.$dns_prefix/g"
fi
}

Просмотреть файл

@ -8,6 +8,8 @@ key_vault=$3
spn_appname=$4
projectstore=$5
appId=$6
source_vm=$7
dns_domain=$8
admin_user=hpcadmin
ssh_private_key=${admin_user}_id_rsa
@ -56,16 +58,28 @@ fqdn=$(
--output tsv \
2>/dev/null \
)
if [ "$fqdn" != "" ]; then
# Add the NSG rule for port 443 (https) for the Cycle VM
az network nsg rule create \
-g ${resource_group} \
--nsg-name ${vmname}NSG \
--name cyclehttps \
--priority 2000 \
--protocol Tcp \
--destination-port-ranges 443 \
--output table
az network nsg rule create \
-g ${resource_group} \
--nsg-name ${vmname}NSG \
--name cyclehttps \
--priority 2000 \
--protocol Tcp \
--destination-port-ranges 443 \
--output table
source_vm=$fqdn
else
fqdn=$(az network private-dns record-set list -g ${resource_group} -z ${dns_domain} --query "[?name=='${vmname}']" -o yaml | grep fqdn | awk -F " " '{print $2}')
#fqdn=${fqdn::-1}
source_vm=$(
az network public-ip show \
--resource-group $resource_group \
--name ${source_vm}pip --query dnsSettings.fqdn \
--output tsv \
2>/dev/null \
)
fi
echo "Creating storage account $projectstore for projects"
az storage account create \
@ -95,11 +109,13 @@ fi
echo "Get cyclecloud_install.py"
downloadURL="https://cyclecloudarm.azureedge.net/cyclecloudrelease"
release="latest"
echo wget "$downloadURL/$release/cyclecloud_install.py" -O cyclecloud_install.py
wget -q "$downloadURL/$release/cyclecloud_install.py" -O cyclecloud_install.py
echo "Run cyclecloud_install.py on $fqdn"
scp $SSH_ARGS -q -i $ssh_private_key cyclecloud_install.py $admin_user@$fqdn:.
ssh $SSH_ARGS -q -i $ssh_private_key $admin_user@$fqdn "sudo python cyclecloud_install.py \
scp -q $SSH_ARGS -i $ssh_private_key cyclecloud_install.py $admin_user@$source_vm:.
ssh $SSH_ARGS -q -i $ssh_private_key $admin_user@$source_vm "scp $SSH_ARGS cyclecloud_install.py $admin_user@$fqdn:."
ssh $SSH_ARGS -q -i $ssh_private_key $admin_user@$source_vm "ssh -vvv $SSH_ARGS $admin_user@$fqdn 'sudo python cyclecloud_install.py \
--applicationSecret ${secret} \
--applicationId $appId \
--tenantId $tenantId \
@ -108,7 +124,7 @@ ssh $SSH_ARGS -q -i $ssh_private_key $admin_user@$fqdn "sudo python cyclecloud_i
--hostname $fqdn \
--acceptTerms \
--password ${password} \
--storageAccount $projectstore"
--storageAccount $projectstore'"
if [ "$?" -ne "0" ]; then
echo "Error : Error installing Cycle Cloud"
exit 1