{ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "name": { "type": "string", "defaultValue": "covid19folding", "metadata": { "description": "The name used to identify your virtual machine." } }, "location": { "type": "string", "defaultValue": "[resourceGroup().location]", "metadata": { "description": "The location in which your virtual machine will be deployed." } }, "sku": { "type": "string", "defaultValue": "Standard_NC6_Promo", "allowedValues": [ "Standard_NC6_Promo", "Standard_NC12_Promo", "Standard_NC24_Promo", "Standard_NC6", "Standard_NC12", "Standard_NC24", "Standard_NC6s_v2", "Standard_NC12s_v2", "Standard_NC24s_v2", "Standard_NC6s_v3", "Standard_NC12s_v3", "Standard_NC24s_v3" ], "metadata": { "description": "The virtual machine SKU to use when running F@H." } }, "fah_team": { "type": "int", "defaultValue": 240722, "minValue": 0, "metadata": { "description": "The ID of the Folding@Home team you wish to contribute towards." } }, "ssh_key": { "type": "securestring", "metadata": { "description": "Your SSH public key" } } }, "variables": { "adminUsername": "folding", "cloudinit-lines": [ "#cloud-config", "package_upgrade: true", "", "write_files:", " - path: /etc/fahclient/config.xml", " content: |", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "[concat(' ')]", " ", " ", " ", " ", " ", " ", "", "runcmd:", " - [ add-apt-repository, 'ppa:graphics-drivers/ppa' ]", " - [ apt, install, -y, nvidia-headless-440, ocl-icd-opencl-dev ]", " - [ sh, -xc, 'echo fahclient fahclient/autostart boolean true | debconf-set-selections' ]", " - [ wget, 'https://download.foldingathome.org/releases/public/release/fahclient/debian-stable-64bit/v7.5/fahclient_7.5.1_amd64.deb', -O, '/tmp/fahclient.deb' ]", " - [ dpkg, -i, --force-depends, /tmp/fahclient.deb ]", "" ], "cloudinit": "[utils.join(variables('cloudinit-lines'))]", "nsgName": "[concat(parameters('name'), '_nsg')]", "nsgId": "[resourceId(resourceGroup().name, 'Microsoft.Network/networkSecurityGroups', variables('nsgName'))]", "nicName": "[concat(parameters('name'), '_nic')]", "ipName": "[concat(parameters('name'), 'ip')]", "vnetName": "[concat(parameters('name'), '-vnet')]", "subnetName": "default", "vnetId": "[resourceId(resourceGroup().name, 'Microsoft.Network/virtualNetworks', variables('vnetName'))]", "subnetRef": "[concat(variables('vnetId'), '/subnets/', variables('subnetName'))]" }, "functions": [ { "namespace": "utils", "members": { "join": { "parameters": [ { "name": "lines", "type": "array" } ], "output": { "type": "string", "value": "[replace(replace(replace(string(parameters('lines')), '[\"', ''), '\"]', ''), '\",\"', '\n')]" } } } } ], "resources": [ { "type": "Microsoft.Network/virtualNetworks", "apiVersion": "2019-11-01", "name": "[variables('vnetName')]", "location": "[parameters('location')]", "properties": { "addressSpace": { "addressPrefixes": [ "10.27.0.0/24" ] }, "subnets": [ { "name": "[variables('subnetName')]", "properties": { "addressPrefix": "10.27.0.0/24", "delegations": [ ], "privateEndpointNetworkPolicies": "Enabled", "privateLinkServiceNetworkPolicies": "Enabled" } } ], "virtualNetworkPeerings": [ ], "enableDdosProtection": false, "enableVmProtection": false } }, { "type": "Microsoft.Network/virtualNetworks/subnets", "apiVersion": "2019-11-01", "name": "[concat(variables('vnetName'), '/', variables('subnetName'))]", "dependsOn": [ "[resourceId('Microsoft.Network/virtualNetworks', variables('vnetName'))]" ], "properties": { "addressPrefix": "10.27.0.0/24", "delegations": [ ], "privateEndpointNetworkPolicies": "Enabled", "privateLinkServiceNetworkPolicies": "Enabled" } }, { "name": "[variables('nicName')]", "type": "Microsoft.Network/networkInterfaces", "apiVersion": "2019-07-01", "location": "[parameters('location')]", "dependsOn": [ "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('vnetName'), variables('subnetName'))]", "[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]", "[concat('Microsoft.Network/publicIpAddresses/', variables('ipName'))]" ], "properties": { "ipConfigurations": [ { "name": "ipconfig1", "properties": { "subnet": { "id": "[variables('subnetRef')]" }, "privateIPAllocationMethod": "Dynamic", "publicIpAddress": { "id": "[resourceId(resourceGroup().name, 'Microsoft.Network/publicIpAddresses', variables('ipName'))]" } } } ], "networkSecurityGroup": { "id": "[variables('nsgId')]" } } }, { "name": "[variables('nsgName')]", "type": "Microsoft.Network/networkSecurityGroups", "apiVersion": "2019-02-01", "location": "[parameters('location')]", "properties": { "securityRules": [ { "name": "SSH", "properties": { "priority": 300, "protocol": "TCP", "access": "Allow", "direction": "Inbound", "sourceAddressPrefix": "*", "sourcePortRange": "*", "destinationAddressPrefix": "*", "destinationPortRange": "22" } } ] } }, { "name": "[variables('ipName')]", "type": "Microsoft.Network/publicIpAddresses", "apiVersion": "2019-02-01", "location": "[parameters('location')]", "properties": { "publicIPAddressVersion": "IPv4", "publicIpAllocationMethod": "Dynamic", "idleTimeoutInMinutes": 4 }, "sku": { "name": "Basic" } }, { "name": "[parameters('name')]", "type": "Microsoft.Compute/virtualMachines", "apiVersion": "2019-07-01", "location": "[parameters('location')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]" ], "properties": { "hardwareProfile": { "vmSize": "[parameters('sku')]" }, "storageProfile": { "osDisk": { "createOption": "fromImage", "managedDisk": { "storageAccountType": "Standard_LRS" } }, "imageReference": { "publisher": "Canonical", "offer": "UbuntuServer", "sku": "18.04-LTS", "version": "latest" } }, "networkProfile": { "networkInterfaces": [ { "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]" } ] }, "osProfile": { "computerName": "[parameters('name')]", "adminUsername": "[variables('adminUsername')]", "linuxConfiguration": { "disablePasswordAuthentication": true, "ssh": { "publicKeys": [ { "path": "[concat('/home/', variables('adminUsername'), '/.ssh/authorized_keys')]", "keyData": "[parameters('ssh_key')]" } ] } }, "customData": "[base64(variables('cloudinit'))]" } } } ], "outputs": { "foldingAtHomeTeam": { "type": "int", "value": "[parameters('fah_team')]" }, "adminUsername": { "type": "string", "value": "[variables('adminUsername')]" } } }