зеркало из
1
0
Форкнуть 0

refactor to ensure master is provisioned first

This commit is contained in:
Trent Swanson 2015-04-24 21:46:27 -07:00
Родитель 7cf175fc53
Коммит fbdbb5702e
3 изменённых файлов: 89 добавлений и 56 удалений

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

@ -22,6 +22,12 @@
}, },
"replicatorPassword": { "replicatorPassword": {
"type": "securestring" "type": "securestring"
},
"masterIpdAddress": {
"type": "string"
},
"offset": {
"type": "int"
} }
}, },
"variables": { "variables": {
@ -38,7 +44,7 @@
{ {
"apiVersion": "2015-05-01-preview", "apiVersion": "2015-05-01-preview",
"type": "Microsoft.Network/networkInterfaces", "type": "Microsoft.Network/networkInterfaces",
"name": "[concat(variables('nicName'), copyindex())]", "name": "[concat(variables('nicName'), copyindex(parameters('offset')))]",
"location": "[variables('region')]", "location": "[variables('region')]",
"copy": { "copy": {
"name": "nicCopyLoop", "name": "nicCopyLoop",
@ -61,10 +67,10 @@
{ {
"apiVersion": "2015-05-01-preview", "apiVersion": "2015-05-01-preview",
"type": "Microsoft.Compute/virtualMachines", "type": "Microsoft.Compute/virtualMachines",
"name": "[concat(variables('vmName'), copyindex())]", "name": "[concat(variables('vmName'), copyindex(parameters('offset')))]",
"location": "[variables('region')]", "location": "[variables('region')]",
"dependsOn": [ "dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'), copyindex())]" "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'), copyindex(parameters('offset')))]"
], ],
"copy": { "copy": {
"name": "vmCopyLoop", "name": "vmCopyLoop",
@ -78,7 +84,7 @@
"vmSize": "[parameters('machineSettings').vmSize]" "vmSize": "[parameters('machineSettings').vmSize]"
}, },
"osProfile": { "osProfile": {
"computername": "[concat(variables('vmName'), copyindex())]", "computername": "[concat(variables('vmName'), copyindex(parameters('offset')))]",
"adminUsername": "[variables('adminUsername')]", "adminUsername": "[variables('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]" "adminPassword": "[parameters('adminPassword')]"
}, },
@ -87,7 +93,7 @@
"osDisk": { "osDisk": {
"name": "osdisk", "name": "osdisk",
"vhd": { "vhd": {
"uri": "[concat('http://',parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/', variables('vmName'), copyindex(), '-osdisk.vhd')]" "uri": "[concat('http://',parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/', variables('vmName'), copyindex(parameters('offset')), '-osdisk.vhd')]"
}, },
"caching": "ReadWrite", "caching": "ReadWrite",
"createOption": "FromImage" "createOption": "FromImage"
@ -98,7 +104,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 0, "lun": 0,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk1.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk1.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -108,7 +114,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 1, "lun": 1,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk2.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk2.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -118,7 +124,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 2, "lun": 2,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk3.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk3.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -128,7 +134,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 3, "lun": 3,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk4.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk4.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -138,7 +144,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 4, "lun": 4,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk5.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk5.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -148,7 +154,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 5, "lun": 5,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk6.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk6.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -158,7 +164,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 6, "lun": 6,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk7.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk7.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -168,7 +174,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 7, "lun": 7,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk8.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk8.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -178,7 +184,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 8, "lun": 8,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk9.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk9.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -188,7 +194,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 9, "lun": 9,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk10.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk10.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -198,7 +204,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 10, "lun": 10,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk11.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk11.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -208,7 +214,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 11, "lun": 11,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk12.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk12.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -218,7 +224,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 12, "lun": 12,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk13.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk13.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -228,7 +234,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 13, "lun": 13,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk14.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk14.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -238,7 +244,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 14, "lun": 14,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk15.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk15.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -248,7 +254,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 15, "lun": 15,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk16.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk16.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -258,7 +264,7 @@
"networkProfile": { "networkProfile": {
"networkInterfaces": [ "networkInterfaces": [
{ {
"id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nicName'), copyindex()) )]" "id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nicName'), copyindex(parameters('offset'))) )]"
} }
] ]
} }
@ -266,11 +272,11 @@
}, },
{ {
"type": "Microsoft.Compute/virtualMachines/extensions", "type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('vmName'), copyindex(), '/install_postgresql')]", "name": "[concat(variables('vmName'), copyindex(parameters('offset')), '/install_postgresql')]",
"apiVersion": "2015-05-01-preview", "apiVersion": "2015-05-01-preview",
"location": "[variables('region')]", "location": "[variables('region')]",
"dependsOn": [ "dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'), copyindex())]" "[concat('Microsoft.Compute/virtualMachines/', variables('vmName'), copyindex(parameters('offset')))]"
], ],
"copy": { "copy": {
"name": "scriptCopyLoop", "name": "scriptCopyLoop",
@ -282,10 +288,15 @@
"typeHandlerVersion": "1.2", "typeHandlerVersion": "1.2",
"settings": { "settings": {
"fileUris": "[parameters('osSettings').scripts]", "fileUris": "[parameters('osSettings').scripts]",
"commandToExecute": "[concat('bash install_postgresql.sh -m ', reference(concat(variables('nicName'), 0)).ipConfigurations[0].properties.privateIPAddress, ' -s ', parameters('subnet').prefix, ' -t ', copyindex(), ' -p ', parameters('replicatorPassword') )]" "commandToExecute": "[concat('bash install_postgresql.sh -m ', parameters('masterIpdAddress'), ' -s ', parameters('subnet').prefix, ' -t ', copyindex(parameters('offset')), ' -p ', parameters('replicatorPassword') )]"
} }
} }
} }
], ],
"outputs": {} "outputs": {
"masterip": {
"value": "[reference(concat(variables('nicName'),0)).ipConfigurations[0].properties.privateIPAddress]",
"type": "string"
}
}
} }

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

@ -22,6 +22,12 @@
}, },
"replicatorPassword": { "replicatorPassword": {
"type": "securestring" "type": "securestring"
},
"masterIpdAddress": {
"type": "string"
},
"offset": {
"type": "int"
} }
}, },
"variables": { "variables": {
@ -38,7 +44,7 @@
{ {
"apiVersion": "2015-05-01-preview", "apiVersion": "2015-05-01-preview",
"type": "Microsoft.Network/networkInterfaces", "type": "Microsoft.Network/networkInterfaces",
"name": "[concat(variables('nicName'), copyindex())]", "name": "[concat(variables('nicName'), copyindex(parameters('offset')))]",
"location": "[variables('region')]", "location": "[variables('region')]",
"copy": { "copy": {
"name": "nicCopyLoop", "name": "nicCopyLoop",
@ -61,10 +67,10 @@
{ {
"apiVersion": "2015-05-01-preview", "apiVersion": "2015-05-01-preview",
"type": "Microsoft.Compute/virtualMachines", "type": "Microsoft.Compute/virtualMachines",
"name": "[concat(variables('vmName'), copyindex())]", "name": "[concat(variables('vmName'), copyindex(parameters('offset')))]",
"location": "[variables('region')]", "location": "[variables('region')]",
"dependsOn": [ "dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'), copyindex())]" "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'), copyindex(parameters('offset')))]"
], ],
"copy": { "copy": {
"name": "vmCopyLoop", "name": "vmCopyLoop",
@ -78,7 +84,7 @@
"vmSize": "[parameters('machineSettings').vmSize]" "vmSize": "[parameters('machineSettings').vmSize]"
}, },
"osProfile": { "osProfile": {
"computername": "[concat(variables('vmName'), copyindex())]", "computername": "[concat(variables('vmName'), copyindex(parameters('offset')))]",
"adminUsername": "[variables('adminUsername')]", "adminUsername": "[variables('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]" "adminPassword": "[parameters('adminPassword')]"
}, },
@ -87,7 +93,7 @@
"osDisk": { "osDisk": {
"name": "osdisk", "name": "osdisk",
"vhd": { "vhd": {
"uri": "[concat('http://',parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/', variables('vmName'), copyindex(), '-osdisk.vhd')]" "uri": "[concat('http://',parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/', variables('vmName'), copyindex(parameters('offset')), '-osdisk.vhd')]"
}, },
"caching": "ReadWrite", "caching": "ReadWrite",
"createOption": "FromImage" "createOption": "FromImage"
@ -98,7 +104,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 0, "lun": 0,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk1.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk1.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -108,7 +114,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 1, "lun": 1,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk2.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk2.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -118,7 +124,7 @@
"networkProfile": { "networkProfile": {
"networkInterfaces": [ "networkInterfaces": [
{ {
"id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nicName'), copyindex()) )]" "id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nicName'), copyindex(parameters('offset'))) )]"
} }
] ]
} }
@ -126,11 +132,11 @@
}, },
{ {
"type": "Microsoft.Compute/virtualMachines/extensions", "type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('vmName'), copyindex(), '/install_postgresql')]", "name": "[concat(variables('vmName'), copyindex(parameters('offset')), '/install_postgresql')]",
"apiVersion": "2015-05-01-preview", "apiVersion": "2015-05-01-preview",
"location": "[variables('region')]", "location": "[variables('region')]",
"dependsOn": [ "dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'), copyindex())]" "[concat('Microsoft.Compute/virtualMachines/', variables('vmName'), copyindex(parameters('offset')))]"
], ],
"copy": { "copy": {
"name": "scriptCopyLoop", "name": "scriptCopyLoop",
@ -142,10 +148,15 @@
"typeHandlerVersion": "1.2", "typeHandlerVersion": "1.2",
"settings": { "settings": {
"fileUris": "[parameters('osSettings').scripts]", "fileUris": "[parameters('osSettings').scripts]",
"commandToExecute": "[concat('bash install_postgresql.sh -m ', reference(concat(variables('nicName'), 0)).ipConfigurations[0].properties.privateIPAddress, ' -s ', parameters('subnet').prefix, ' -t ', copyindex(), ' -p ', parameters('replicatorPassword') )]" "commandToExecute": "[concat('bash install_postgresql.sh -m ', parameters('masterIpdAddress'), ' -s ', parameters('subnet').prefix, ' -t ', copyindex(parameters('offset')), ' -p ', parameters('replicatorPassword') )]"
} }
} }
} }
], ],
"outputs": {} "outputs": {
"masterip": {
"value": "[reference(concat(variables('nicName'),0)).ipConfigurations[0].properties.privateIPAddress]",
"type": "string"
}
}
} }

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

@ -22,6 +22,12 @@
}, },
"replicatorPassword": { "replicatorPassword": {
"type": "securestring" "type": "securestring"
},
"masterIpdAddress": {
"type": "string"
},
"offset": {
"type": "int"
} }
}, },
"variables": { "variables": {
@ -38,7 +44,7 @@
{ {
"apiVersion": "2015-05-01-preview", "apiVersion": "2015-05-01-preview",
"type": "Microsoft.Network/networkInterfaces", "type": "Microsoft.Network/networkInterfaces",
"name": "[concat(variables('nicName'), copyindex())]", "name": "[concat(variables('nicName'), copyindex(parameters('offset')))]",
"location": "[variables('region')]", "location": "[variables('region')]",
"copy": { "copy": {
"name": "nicCopyLoop", "name": "nicCopyLoop",
@ -61,10 +67,10 @@
{ {
"apiVersion": "2015-05-01-preview", "apiVersion": "2015-05-01-preview",
"type": "Microsoft.Compute/virtualMachines", "type": "Microsoft.Compute/virtualMachines",
"name": "[concat(variables('vmName'), copyindex())]", "name": "[concat(variables('vmName'), copyindex(parameters('offset')))]",
"location": "[variables('region')]", "location": "[variables('region')]",
"dependsOn": [ "dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'), copyindex())]" "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'), copyindex(parameters('offset')))]"
], ],
"copy": { "copy": {
"name": "vmCopyLoop", "name": "vmCopyLoop",
@ -78,7 +84,7 @@
"vmSize": "[parameters('machineSettings').vmSize]" "vmSize": "[parameters('machineSettings').vmSize]"
}, },
"osProfile": { "osProfile": {
"computername": "[concat(variables('vmName'), copyindex())]", "computername": "[concat(variables('vmName'), copyindex(parameters('offset')))]",
"adminUsername": "[variables('adminUsername')]", "adminUsername": "[variables('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]" "adminPassword": "[parameters('adminPassword')]"
}, },
@ -87,7 +93,7 @@
"osDisk": { "osDisk": {
"name": "osdisk", "name": "osdisk",
"vhd": { "vhd": {
"uri": "[concat('http://',parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/', variables('vmName'), copyindex(), '-osdisk.vhd')]" "uri": "[concat('http://',parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/', variables('vmName'), copyindex(parameters('offset')), '-osdisk.vhd')]"
}, },
"caching": "ReadWrite", "caching": "ReadWrite",
"createOption": "FromImage" "createOption": "FromImage"
@ -98,7 +104,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 0, "lun": 0,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk1.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk1.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -108,7 +114,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 1, "lun": 1,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk2.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk2.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -118,7 +124,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 2, "lun": 2,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk3.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk3.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -128,7 +134,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 3, "lun": 3,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk4.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk4.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -138,7 +144,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 4, "lun": 4,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk5.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk5.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -148,7 +154,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 5, "lun": 5,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk6.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk6.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -158,7 +164,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 6, "lun": 6,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk7.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk7.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -168,7 +174,7 @@
"diskSizeGB": "[parameters('machineSettings').diskSize]", "diskSizeGB": "[parameters('machineSettings').diskSize]",
"lun": 7, "lun": 7,
"vhd": { "vhd": {
"Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex()],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(),'-datadisk8.vhd')]" "Uri": "[concat('http://', parameters('storageSettings').name, parameters('storageSettings').map[copyindex(parameters('offset'))],'.blob.core.windows.net/vhds/',variables('vmName'), copyindex(parameters('offset')),'-datadisk8.vhd')]"
}, },
"caching": "None", "caching": "None",
"createOption": "Empty" "createOption": "Empty"
@ -178,7 +184,7 @@
"networkProfile": { "networkProfile": {
"networkInterfaces": [ "networkInterfaces": [
{ {
"id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nicName'), copyindex()) )]" "id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nicName'), copyindex(parameters('offset'))) )]"
} }
] ]
} }
@ -186,11 +192,11 @@
}, },
{ {
"type": "Microsoft.Compute/virtualMachines/extensions", "type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('vmName'), copyindex(), '/install_postgresql')]", "name": "[concat(variables('vmName'), copyindex(parameters('offset')), '/install_postgresql')]",
"apiVersion": "2015-05-01-preview", "apiVersion": "2015-05-01-preview",
"location": "[variables('region')]", "location": "[variables('region')]",
"dependsOn": [ "dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'), copyindex())]" "[concat('Microsoft.Compute/virtualMachines/', variables('vmName'), copyindex(parameters('offset')))]"
], ],
"copy": { "copy": {
"name": "scriptCopyLoop", "name": "scriptCopyLoop",
@ -202,10 +208,15 @@
"typeHandlerVersion": "1.2", "typeHandlerVersion": "1.2",
"settings": { "settings": {
"fileUris": "[parameters('osSettings').scripts]", "fileUris": "[parameters('osSettings').scripts]",
"commandToExecute": "[concat('bash install_postgresql.sh -m ', reference(concat(variables('nicName'), 0)).ipConfigurations[0].properties.privateIPAddress, ' -s ', parameters('subnet').prefix, ' -t ', copyindex(), ' -p ', parameters('replicatorPassword') )]" "commandToExecute": "[concat('bash install_postgresql.sh -m ', parameters('masterIpdAddress'), ' -s ', parameters('subnet').prefix, ' -t ', copyindex(parameters('offset')), ' -p ', parameters('replicatorPassword') )]"
} }
} }
} }
], ],
"outputs": {} "outputs": {
"masterip": {
"value": "[reference(concat(variables('nicName'),0)).ipConfigurations[0].properties.privateIPAddress]",
"type": "string"
}
}
} }