azure arm template for oneclick deploy
[logging-analytics.git] / deploy / azure / _arm_deploy_onap_cd.json
1 {
2   "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
3   "contentVersion": "1.0.0.0",
4   "parameters": {
5       "scriptURL": { "type": "string","metadata": { "description": "entrypoint script location" }},
6       "scriptName": { "type": "string", "metadata": { "description": "entrypoint script name"}},
7       "onapBranch": { "type": "string","metadata": { "description": "onap branch amsterdam or master" }},
8       "onapEnvironment": { "type": "string","metadata": { "description": "onap environment usually defaults to onap" }},
9       "vmName": { "type": "string","metadata": { "description": "Name of the VM" }},
10       "osType": { "type": "string", "allowedValues": ["Linux"], "metadata": { "description": "Type of OS" }},
11       "adminUsername": { "type": "string", "metadata": { "description": "User name for the VM" }},
12       "sshKeyData": { "type": "string", "metadata": { "description": "SSH rsa public key file as a string." }},
13       "dnsLabelPrefix": { "type": "string", "metadata": { "description": "Unique DNS Name for the Public IP used to access the Virtual Machine." }},
14       "ubuntuOSVersion": { "type": "string", "defaultValue": "16.04.0-LTS", "allowedValues": ["16.04.0-LTS"], "metadata": { "description": "The OS"}},
15       "vmSize": { "type": "string",
16       "defaultValue": "Standard_D1",
17       "allowedValues": [
18         "Standard_E8_v3",
19          "Standard_E2_v3",
20          "Standard_D1",
21          "Standard_D4_v3",
22          "Standard_D8S_v3",
23          "Standard_D32s_v3",
24          "Standard_D16s_v3",
25          "Standard_E16_v3",
26          "Standard_E64_v3"],
27          "metadata": { "description": "VM size" }}
28     },
29   "variables": {
30     "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'salinuxvm')]",
31     "imagePublisher": "Canonical",
32     "imageOffer": "UbuntuServer",
33     "nicName": "[concat(parameters('vmName'),'VMNic')]",
34     "addressPrefix": "10.0.0.0/16",
35     "subnetName": "Subnet",
36     "subnetPrefix": "10.0.0.0/24",
37     "storageAccountType": "Standard_LRS",
38     "publicIPAddressName": "[concat(parameters('vmName'),'PublicIP')]",
39     "publicIPAddressType": "Dynamic",
40     "virtualNetworkName": "[concat(parameters('vmName'),'VNET')]",
41     "vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
42     "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
43     "networkSecurityGroupName": "[concat(parameters('vmName'), '_obrien_local_nsg')]",
44     "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]"
45   },
46   "resources": [
47     {
48       "type": "Microsoft.Storage/storageAccounts",
49       "name": "[variables('storageAccountName')]",
50       "apiVersion": "2017-06-01",
51       "location": "[resourceGroup().location]",
52       "sku": { "name": "[variables('storageAccountType')]"},
53       "kind": "Storage",
54       "properties": {}
55     },
56     {
57       "apiVersion": "2017-03-01",
58       "type": "Microsoft.Network/networkSecurityGroups",
59       "name": "[variables('networkSecurityGroupName')]",
60       "location": "[resourceGroup().location]",
61       "tags": { "displayName": "NSG" },
62       "properties": {
63       "securityRules": [
64         {
65           "name": "port_10249-10255_172",
66           "properties": {
67             "description": "port_10249-10255_172",
68             "protocol": "*",
69             "sourcePortRange": "*",
70             "destinationPortRange": "10249-10255",
71             "sourceAddressPrefix": "172.17.0.1/32",
72             "destinationAddressPrefix": "*",
73             "access": "Allow",
74             "priority": 120,
75             "direction": "Inbound"
76             }
77         },
78         {
79           "name": "port_10249-10255_127",
80           "properties": {
81             "description": "port_10249-10255_127",
82             "protocol": "*",
83             "sourcePortRange": "*",
84             "destinationPortRange": "10249-10255",
85             "sourceAddressPrefix": "127.0.0.1/32",
86             "destinationAddressPrefix": "*",
87             "access": "Allow",
88             "priority": 122,
89             "direction": "Inbound"
90             }
91         },
92         {
93           "name": "Port_10249-10255-block",
94           "properties": {
95             "description": "Port_10249-10255-block",
96             "protocol": "Tcp",
97             "sourcePortRange": "*",
98             "destinationPortRange": "10249-10255",
99             "sourceAddressPrefix": "Internet",
100             "destinationAddressPrefix": "*",
101             "access": "Deny",
102             "priority": 130,
103             "direction": "Inbound"
104             }
105         },
106         {
107           "name": "in-rule",
108           "properties": {
109             "description": "All in",
110             "protocol": "Tcp",
111             "sourcePortRange": "*",
112             "destinationPortRange": "*",
113             "sourceAddressPrefix": "Internet",
114             "destinationAddressPrefix": "*",
115             "access": "Allow",
116             "priority": 140,
117             "direction": "Inbound"
118             }
119         },
120        {
121           "name": "block-8080",
122           "properties": {
123             "description": "block-8080",
124             "protocol": "Tcp",
125             "sourcePortRange": "8080",
126             "destinationPortRange": "*",
127             "sourceAddressPrefix": "Internet",
128             "destinationAddressPrefix": "*",
129             "access": "Deny",
130             "priority": 104,
131             "direction": "Outbound"
132             }
133           },
134         {
135           "name": "out-rule",
136           "properties": {
137             "description": "All out",
138             "protocol": "Tcp",
139             "sourcePortRange": "*",
140             "destinationPortRange": "*",
141             "sourceAddressPrefix": "Internet",
142             "destinationAddressPrefix": "*",
143             "access": "Allow",
144             "priority": 110,
145             "direction": "Outbound"
146             }
147           } 
148         ]
149       }
150     },
151     {
152       "apiVersion": "2017-04-01",
153       "type": "Microsoft.Network/publicIPAddresses",
154       "name": "[variables('publicIPAddressName')]",
155       "location": "[resourceGroup().location]",
156       "properties": {
157         "publicIPAllocationMethod": "[variables('publicIPAddressType')]",
158         "dnsSettings": {
159           "domainNameLabel": "[concat(parameters('vmName'), parameters('dnsLabelPrefix'))]"
160         }
161       }
162     },
163     {
164       "apiVersion": "2017-04-01",
165       "type": "Microsoft.Network/virtualNetworks",
166       "name": "[variables('virtualNetworkName')]",
167       "location": "[resourceGroup().location]",
168       "dependson": [
169         "[concat('Microsoft.Network/networkSecurityGroups/', variables('networkSecurityGroupName'))]"
170       ],
171       "properties": {
172         "addressSpace": {
173           "addressPrefixes": [ "[variables('addressPrefix')]" ]
174         },
175         "subnets": [
176           {
177             "name": "[variables('subnetName')]",
178             "properties": {
179               "addressPrefix": "[variables('subnetPrefix')]",
180               "networkSecurityGroup": {
181                  "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
182               }
183             }
184           }
185         ]
186       }
187     },
188     {
189       "apiVersion": "2017-04-01",
190       "type": "Microsoft.Network/networkInterfaces",
191       "name": "[variables('nicName')]",
192       "location": "[resourceGroup().location]",
193       "dependsOn": [
194         "[resourceId('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
195         "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
196       ],
197       "properties": {
198         "ipConfigurations": [      {
199             "name": "ipconfig1",
200             "properties": {
201               "privateIPAllocationMethod": "Dynamic",
202               "publicIPAddress": { "id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]" },
203               "subnet": { "id": "[variables('subnetRef')]" }
204             }
205           }
206         ]
207       }
208     },
209     {
210       "apiVersion": "2017-03-30",
211       "type": "Microsoft.Compute/virtualMachines",
212       "name": "[parameters('vmName')]",
213       "location": "[resourceGroup().location]",
214       "dependsOn": [
215         "[resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
216         "[resourceId('Microsoft.Network/networkInterfaces/', variables('nicName'))]"],
217       "properties": {
218         "hardwareProfile": { "vmSize": "[parameters('vmSize')]"},
219         "osProfile": {
220           "computerName": "[parameters('vmName')]",
221           "adminUsername": "[parameters('adminUsername')]",
222           "linuxConfiguration": {
223           "disablePasswordAuthentication": true,
224           "ssh": { "publicKeys": [{
225                         "path": "[variables('sshKeyPath')]",
226                         "keyData": "[parameters('sshKeyData')]"
227                     }]}}},
228         "storageProfile": {
229           "imageReference": {
230             "publisher": "[variables('imagePublisher')]",
231             "offer": "[variables('imageOffer')]",
232             "sku": "[parameters('ubuntuOSVersion')]",
233             "version": "latest"
234           },
235           "osDisk": { "diskSizeGB": 127, "createOption": "FromImage" },
236           "dataDisks": [ {"diskSizeGB": 127, "lun": 0, "createOption": "Empty" }]},
237         "networkProfile": {
238           "networkInterfaces": [{ "id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"}]},
239         "diagnosticsProfile": {
240           "bootDiagnostics": { "enabled": true,
241             "storageUri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), '2016-01-01').primaryEndpoints.blob)]"
242           }} }
243     },
244
245     {
246     "apiVersion": "2017-12-01",
247     "type": "Microsoft.Compute/virtualMachines/extensions",
248     "name": "[concat(parameters('vmName'),'/onap')]",
249     "location": "[resourceGroup().location]",   
250     "dependsOn": ["[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]"],
251     "properties": {
252         "publisher": "Microsoft.Azure.Extensions",
253         "type": "CustomScript",
254         "typeHandlerVersion": "2.0",
255         "autoUpgradeMinorVersion": true,
256         "settings": {
257             "fileUris": [ "[parameters('scriptURL')]" ],
258             "commandToExecute": "[concat('./' , parameters('scriptName'), ' -b ', parameters('onapBranch'), ' -s ', parameters('vmName'), ' -e ', parameters('onapEnvironment'))]"
259            }
260         }
261      }
262      
263  ],
264   "outputs": {
265     "hostname": {
266       "type": "string",
267       "value": "[reference(variables('publicIPAddressName')).dnsSettings.fqdn]"
268     },
269     "sshCommand": {
270       "type": "string",
271       "value": "[concat('ssh ', parameters('adminUsername'), '@', reference(variables('publicIPAddressName')).dnsSettings.fqdn)]"
272     }
273   }
274 }