Skip to content

Commit 04f3068

Browse files
committed
update vm on separate script
1 parent ddb0c6c commit 04f3068

File tree

3 files changed

+50
-14
lines changed

3 files changed

+50
-14
lines changed

postgres_startup.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ adminPassword=$6
99
hacfgFile=postgresha.cfg
1010
patroniCfg=postgres.yml
1111

12-
export DEBIAN_FRONTEND=noninteractive
1312
sudo touch /usr/local/startup.log
1413
sudo chmod 666 /usr/local/startup.log
1514
echo "Cluster name: $clusterName" >> /usr/local/startup.log
@@ -40,8 +39,6 @@ echo "" >> /usr/local/startup.log
4039
# update package lists for PostgreSQL 9.6
4140
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
4241
wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -
43-
sudo apt-get --assume-yes -qq update
44-
sudo apt-get --assume-yes -qq upgrade
4542
sudo apt-get --assume-yes -qq install jq
4643
echo "apt-get update exited with: $?"
4744
echo "updated packages" >> /usr/local/startup.log

template.json

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,31 @@
326326
"fileUris": [
327327
"[concat(parameters('_artifactsLocation'), '/zookeeper_startup.sh')]"
328328
],
329-
"commandToExecute": "[concat('sh zookeeper_startup.sh ', copyIndex(), ' ', variables('zookeeperInstanceCount'))]",
330-
"Restart": "true"
329+
"commandToExecute": "[concat('sh zookeeper_startup.sh ', copyIndex(), ' ', variables('zookeeperInstanceCount'))]"
330+
}
331+
},
332+
"dependsOn": [
333+
"[concat('Microsoft.Compute/virtualMachines/', 'zookeeper', copyIndex())]"
334+
]
335+
},
336+
{
337+
"type": "Microsoft.Compute/virtualMachines/extensions",
338+
"name": "[concat('zookeeper', copyIndex(), '/zookeeperExtension')]",
339+
"apiVersion": "2015-05-01-preview",
340+
"location": "[resourceGroup().location]",
341+
"copy": {
342+
"name": "zookeeperExtLoop",
343+
"count": "[variables('zookeeperInstanceCount')]"
344+
},
345+
"properties": {
346+
"publisher": "Microsoft.OSTCExtensions",
347+
"type": "OSPatchingForLinux",
348+
"typeHandlerVersion": "2.9",
349+
"Settings": {
350+
"disabled": false,
351+
"stop": false,
352+
"category": "ImportantAndRecommended",
353+
"oneoff": true
331354
}
332355
},
333356
"dependsOn": [
@@ -457,8 +480,31 @@
457480
"[concat(parameters('_artifactsLocation'), '/autopart.sh')]",
458481
"[concat(parameters('_artifactsLocation'), '/postgres_startup.sh')]"
459482
],
460-
"commandToExecute": "[concat('sh postgres_startup.sh ', parameters('clusterName'), ' ', variables('zookeeperInstanceCount'), ' ', variables('postgresInstanceCount'), ' ', copyIndex(), ' ', parameters('adminUsername'), ' \"', parameters('adminPassword'), '\" ')]",
461-
"Restart": "true"
483+
"commandToExecute": "[concat('sh postgres_startup.sh ', parameters('clusterName'), ' ', variables('zookeeperInstanceCount'), ' ', variables('postgresInstanceCount'), ' ', copyIndex(), ' ', parameters('adminUsername'), ' \"', parameters('adminPassword'), '\" ')]"
484+
}
485+
},
486+
"dependsOn": [
487+
"[concat('Microsoft.Compute/virtualMachines/', 'postgres', copyIndex())]"
488+
]
489+
},
490+
{
491+
"type": "Microsoft.Compute/virtualMachines/extensions",
492+
"name": "[concat('postgres', copyIndex(), '/postgresExtension')]",
493+
"apiVersion": "2015-05-01-preview",
494+
"location": "[resourceGroup().location]",
495+
"copy": {
496+
"name": "postgresExtLoop",
497+
"count": "[variables('postgresInstanceCount')]"
498+
},
499+
"properties": {
500+
"publisher": "Microsoft.OSTCExtensions",
501+
"type": "OSPatchingForLinux",
502+
"typeHandlerVersion": "2.9",
503+
"Settings": {
504+
"disabled": false,
505+
"stop": false,
506+
"category": "ImportantAndRecommended",
507+
"oneoff": true
462508
}
463509
},
464510
"dependsOn": [

zookeeper_startup.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
#!/bin/bash
2-
export DEBIAN_FRONTEND=noninteractive
3-
sudo touch /usr/local/startup.log
4-
sudo chmod 666 /usr/local/startup.log
5-
sudo apt-get --assume-yes -qq update
6-
echo "ran update" >> /usr/local/startup.log
7-
sudo apt-get --assume-yes -qq upgrade
8-
echo "ran upgrade" >> /usr/local/startup.log
92
sudo apt-get --assume-yes -qq install jq
103
echo "ran install" >> /usr/local/startup.log
114
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/7u75-b13/jdk-7u75-linux-x64.tar.gz"

0 commit comments

Comments
 (0)