Added ARM, AWS templates and pipelines.

This commit is contained in:
jefferyfry
2020-04-28 21:10:29 -07:00
parent 38d2524ee1
commit 4e9153dffa
156 changed files with 5757 additions and 725 deletions

View File

@@ -0,0 +1,769 @@
{
"Description": "This template deploys a VPC, with a pair of public and private subnets spread across two Availability Zones. It deploys an internet gateway, with a default route on the public subnets. It deploys a pair of NAT gateways (one in each AZ), and default routes for them in the private subnets.",
"Parameters": {
"SSHKeyName": {
"Description": "Name of the ec2 key you need one to use this template",
"Type": "AWS::EC2::KeyPair::KeyName",
"Default": "choose-key"
},
"EnvironmentName": {
"Description": "An environment name that is prefixed to resource names",
"Type": "String",
"Default": "Ansible"
},
"VpcCIDR": {
"Description": "Please enter the IP range (CIDR notation) for this VPC",
"Type": "String",
"Default": "10.192.0.0/16"
},
"PublicSubnet1CIDR": {
"Description": "Please enter the IP range (CIDR notation) for the public subnet in the first Availability Zone",
"Type": "String",
"Default": "10.192.10.0/24"
},
"PublicSubnet2CIDR": {
"Description": "Please enter the IP range (CIDR notation) for the public subnet in the second Availability Zone",
"Type": "String",
"Default": "10.192.11.0/24"
},
"PrivateSubnet1CIDR": {
"Description": "Please enter the IP range (CIDR notation) for the private subnet in the first Availability Zone",
"Type": "String",
"Default": "10.192.20.0/24"
},
"PrivateSubnet2CIDR": {
"Description": "Please enter the IP range (CIDR notation) for the private subnet in the second Availability Zone",
"Type": "String",
"Default": "10.192.21.0/24"
}
},
"Mappings": {
"RegionToAmazonAMI": {
"us-east-1": {
"HVM64": "ami-03e33c1cefd1d3d74"
},
"us-east-2": {
"HVM64": "ami-07d9419c80dc1113c"
},
"us-west-1": {
"HVM64": "ami-0ee1a20d6b0c6a347"
},
"us-west-2": {
"HVM64": "ami-0813245c0939ab3ca"
}
}
},
"Resources": {
"VPC": {
"Type": "AWS::EC2::VPC",
"Properties": {
"CidrBlock": {
"Ref": "VpcCIDR"
},
"EnableDnsSupport": true,
"EnableDnsHostnames": true,
"Tags": [
{
"Key": "Name",
"Value": {
"Ref": "EnvironmentName"
}
}
]
}
},
"InternetGateway": {
"Type": "AWS::EC2::InternetGateway",
"Properties": {
"Tags": [
{
"Key": "Name",
"Value": {
"Ref": "EnvironmentName"
}
}
]
}
},
"InternetGatewayAttachment": {
"Type": "AWS::EC2::VPCGatewayAttachment",
"Properties": {
"InternetGatewayId": {
"Ref": "InternetGateway"
},
"VpcId": {
"Ref": "VPC"
}
}
},
"PublicSubnet1": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"VpcId": {
"Ref": "VPC"
},
"AvailabilityZone": {
"Fn::Select": [
0,
{
"Fn::GetAZs": ""
}
]
},
"CidrBlock": {
"Ref": "PublicSubnet1CIDR"
},
"MapPublicIpOnLaunch": true,
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "${EnvironmentName} Public Subnet (AZ1)"
}
}
]
}
},
"PublicSubnet2": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"VpcId": {
"Ref": "VPC"
},
"AvailabilityZone": {
"Fn::Select": [
1,
{
"Fn::GetAZs": ""
}
]
},
"CidrBlock": {
"Ref": "PublicSubnet2CIDR"
},
"MapPublicIpOnLaunch": true,
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "${EnvironmentName} Public Subnet (AZ2)"
}
}
]
}
},
"PrivateSubnet1": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"VpcId": {
"Ref": "VPC"
},
"AvailabilityZone": {
"Fn::Select": [
0,
{
"Fn::GetAZs": ""
}
]
},
"CidrBlock": {
"Ref": "PrivateSubnet1CIDR"
},
"MapPublicIpOnLaunch": false,
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "${EnvironmentName} Private Subnet (AZ1)"
}
}
]
}
},
"PrivateSubnet2": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"VpcId": {
"Ref": "VPC"
},
"AvailabilityZone": {
"Fn::Select": [
1,
{
"Fn::GetAZs": ""
}
]
},
"CidrBlock": {
"Ref": "PrivateSubnet2CIDR"
},
"MapPublicIpOnLaunch": false,
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "${EnvironmentName} Private Subnet (AZ2)"
}
}
]
}
},
"NatGateway1EIP": {
"Type": "AWS::EC2::EIP",
"DependsOn": "InternetGatewayAttachment",
"Properties": {
"Domain": "vpc"
}
},
"NatGateway2EIP": {
"Type": "AWS::EC2::EIP",
"DependsOn": "InternetGatewayAttachment",
"Properties": {
"Domain": "vpc"
}
},
"NatGateway1": {
"Type": "AWS::EC2::NatGateway",
"Properties": {
"AllocationId": {
"Fn::GetAtt": [
"NatGateway1EIP",
"AllocationId"
]
},
"SubnetId": {
"Ref": "PublicSubnet1"
}
}
},
"NatGateway2": {
"Type": "AWS::EC2::NatGateway",
"Properties": {
"AllocationId": {
"Fn::GetAtt": [
"NatGateway2EIP",
"AllocationId"
]
},
"SubnetId": {
"Ref": "PublicSubnet2"
}
}
},
"PublicRouteTable": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {
"Ref": "VPC"
},
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "${EnvironmentName} Public Routes"
}
}
]
}
},
"DefaultPublicRoute": {
"Type": "AWS::EC2::Route",
"DependsOn": "InternetGatewayAttachment",
"Properties": {
"RouteTableId": {
"Ref": "PublicRouteTable"
},
"DestinationCidrBlock": "0.0.0.0/0",
"GatewayId": {
"Ref": "InternetGateway"
}
}
},
"PublicSubnet1RouteTableAssociation": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"RouteTableId": {
"Ref": "PublicRouteTable"
},
"SubnetId": {
"Ref": "PublicSubnet1"
}
}
},
"PublicSubnet2RouteTableAssociation": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"RouteTableId": {
"Ref": "PublicRouteTable"
},
"SubnetId": {
"Ref": "PublicSubnet2"
}
}
},
"PrivateRouteTable1": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {
"Ref": "VPC"
},
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "${EnvironmentName} Private Routes (AZ1)"
}
}
]
}
},
"DefaultPrivateRoute1": {
"Type": "AWS::EC2::Route",
"Properties": {
"RouteTableId": {
"Ref": "PrivateRouteTable1"
},
"DestinationCidrBlock": "0.0.0.0/0",
"NatGatewayId": {
"Ref": "NatGateway1"
}
}
},
"PrivateSubnet1RouteTableAssociation": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"RouteTableId": {
"Ref": "PrivateRouteTable1"
},
"SubnetId": {
"Ref": "PrivateSubnet1"
}
}
},
"PrivateRouteTable2": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {
"Ref": "VPC"
},
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "${EnvironmentName} Private Routes (AZ2)"
}
}
]
}
},
"DefaultPrivateRoute2": {
"Type": "AWS::EC2::Route",
"Properties": {
"RouteTableId": {
"Ref": "PrivateRouteTable2"
},
"DestinationCidrBlock": "0.0.0.0/0",
"NatGatewayId": {
"Ref": "NatGateway2"
}
}
},
"PrivateSubnet2RouteTableAssociation": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"RouteTableId": {
"Ref": "PrivateRouteTable2"
},
"SubnetId": {
"Ref": "PrivateSubnet2"
}
}
},
"EC2SecurityGroup": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"GroupDescription": "SSH, Port 80, Database",
"VpcId": {
"Ref": "VPC"
},
"SecurityGroupIngress": [
{
"IpProtocol": "tcp",
"FromPort": 22,
"ToPort": 22,
"CidrIp": "0.0.0.0/0"
},
{
"IpProtocol": "tcp",
"FromPort": 5432,
"ToPort": 5432,
"CidrIp": "0.0.0.0/0"
},
{
"IpProtocol": "tcp",
"FromPort": 8082,
"ToPort": 8082,
"CidrIp": "0.0.0.0/0"
},
{
"IpProtocol": "tcp",
"FromPort": 80,
"ToPort": 80,
"SourceSecurityGroupId": {
"Ref": "ELBSecurityGroup"
}
}
]
}
},
"ELBSecurityGroup": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"GroupDescription": "SSH and Port 80",
"VpcId": {
"Ref": "VPC"
},
"SecurityGroupIngress": [
{
"IpProtocol": "tcp",
"FromPort": 80,
"ToPort": 80,
"CidrIp": "0.0.0.0/0"
}
]
}
},
"BastionInstance": {
"Type": "AWS::EC2::Instance",
"Properties": {
"ImageId": {
"Fn::FindInMap": [
"RegionToAmazonAMI",
{
"Ref": "AWS::Region"
},
"HVM64"
]
},
"InstanceInitiatedShutdownBehavior": "stop",
"InstanceType": "t2.medium",
"KeyName": {
"Ref": "SSHKeyName"
},
"Monitoring": "true",
"NetworkInterfaces": [
{
"AssociatePublicIpAddress": "true",
"DeviceIndex": "0",
"GroupSet": [
{
"Ref": "EC2SecurityGroup"
}
],
"SubnetId": {
"Ref": "PublicSubnet1"
}
}
],
"Tags": [
{
"Key": "Name",
"Value": "bastion"
}
],
"Tenancy": "default"
}
},
"RTPriInstance": {
"Type": "AWS::EC2::Instance",
"Properties": {
"ImageId": {
"Fn::FindInMap": [
"RegionToAmazonAMI",
{
"Ref": "AWS::Region"
},
"HVM64"
]
},
"InstanceInitiatedShutdownBehavior": "stop",
"InstanceType": "t2.medium",
"KeyName": {
"Ref": "SSHKeyName"
},
"Monitoring": "true",
"NetworkInterfaces": [
{
"AssociatePublicIpAddress": "false",
"DeviceIndex": "0",
"GroupSet": [
{
"Ref": "EC2SecurityGroup"
}
],
"SubnetId": {
"Ref": "PrivateSubnet1"
}
}
],
"Tags": [
{
"Key": "Name",
"Value": "rtprimary"
}
],
"Tenancy": "default"
}
},
"RTSecInstance": {
"Type": "AWS::EC2::Instance",
"Properties": {
"ImageId": {
"Fn::FindInMap": [
"RegionToAmazonAMI",
{
"Ref": "AWS::Region"
},
"HVM64"
]
},
"InstanceInitiatedShutdownBehavior": "stop",
"InstanceType": "t2.medium",
"KeyName": {
"Ref": "SSHKeyName"
},
"Monitoring": "true",
"NetworkInterfaces": [
{
"AssociatePublicIpAddress": "false",
"DeviceIndex": "0",
"GroupSet": [
{
"Ref": "EC2SecurityGroup"
}
],
"SubnetId": {
"Ref": "PrivateSubnet2"
}
}
],
"Tags": [
{
"Key": "Name",
"Value": "rtsecondary"
}
],
"Tenancy": "default"
}
},
"XrayInstance": {
"Type": "AWS::EC2::Instance",
"Properties": {
"ImageId": {
"Fn::FindInMap": [
"RegionToAmazonAMI",
{
"Ref": "AWS::Region"
},
"HVM64"
]
},
"InstanceInitiatedShutdownBehavior": "stop",
"InstanceType": "t2.medium",
"KeyName": {
"Ref": "SSHKeyName"
},
"Monitoring": "true",
"NetworkInterfaces": [
{
"AssociatePublicIpAddress": "false",
"DeviceIndex": "0",
"GroupSet": [
{
"Ref": "EC2SecurityGroup"
}
],
"SubnetId": {
"Ref": "PrivateSubnet1"
}
}
],
"Tags": [
{
"Key": "Name",
"Value": "xray"
}
],
"Tenancy": "default"
}
},
"DBInstance": {
"Type": "AWS::EC2::Instance",
"Properties": {
"ImageId": {
"Fn::FindInMap": [
"RegionToAmazonAMI",
{
"Ref": "AWS::Region"
},
"HVM64"
]
},
"InstanceInitiatedShutdownBehavior": "stop",
"InstanceType": "t2.medium",
"KeyName": {
"Ref": "SSHKeyName"
},
"Monitoring": "true",
"NetworkInterfaces": [
{
"AssociatePublicIpAddress": "false",
"DeviceIndex": "0",
"GroupSet": [
{
"Ref": "EC2SecurityGroup"
}
],
"SubnetId": {
"Ref": "PrivateSubnet1"
}
}
],
"Tags": [
{
"Key": "Name",
"Value": "database"
}
],
"Tenancy": "default"
}
},
"EC2TargetGroup": {
"Type": "AWS::ElasticLoadBalancingV2::TargetGroup",
"Properties": {
"HealthCheckIntervalSeconds": 30,
"HealthCheckProtocol": "HTTP",
"HealthCheckTimeoutSeconds": 15,
"HealthyThresholdCount": 2,
"Matcher": {
"HttpCode": "200,302"
},
"Name": "EC2TargetGroup",
"Port": 80,
"Protocol": "HTTP",
"TargetGroupAttributes": [
{
"Key": "deregistration_delay.timeout_seconds",
"Value": "20"
}
],
"Targets": [
{
"Id": {
"Ref": "RTPriInstance"
}
},
{
"Id": {
"Ref": "RTSecInstance"
},
"Port": 80
}
],
"UnhealthyThresholdCount": 3,
"VpcId": {
"Ref": "VPC"
},
"Tags": [
{
"Key": "Name",
"Value": "EC2TargetGroup"
},
{
"Key": "Port",
"Value": 80
}
]
}
},
"ALBListener": {
"Type": "AWS::ElasticLoadBalancingV2::Listener",
"Properties": {
"DefaultActions": [
{
"Type": "forward",
"TargetGroupArn": {
"Ref": "EC2TargetGroup"
}
}
],
"LoadBalancerArn": {
"Ref": "ApplicationLoadBalancer"
},
"Port": 80,
"Protocol": "HTTP"
}
},
"ApplicationLoadBalancer": {
"Type": "AWS::ElasticLoadBalancingV2::LoadBalancer",
"Properties": {
"Scheme": "internet-facing",
"Subnets": [
{
"Ref": "PublicSubnet1"
},
{
"Ref": "PublicSubnet2"
}
],
"SecurityGroups": [
{
"Ref": "ELBSecurityGroup"
}
]
}
}
},
"Outputs": {
"VPC": {
"Description": "Virtual Private Cloud",
"Value": {
"Ref": "VPC"
}
},
"ALBHostName": {
"Description": "Application Load Balancer Hostname",
"Value": {
"Fn::GetAtt": [
"ApplicationLoadBalancer",
"DNSName"
]
}
},
"BastionInstancePublic": {
"Description": "Bastion",
"Value": { "Fn::GetAtt" : [ "BastionInstance", "PublicIp" ]}
},
"BastionInstancePrivate": {
"Description": "Bastion",
"Value": { "Fn::GetAtt" : [ "BastionInstance", "PrivateIp" ]}
},
"RTPriInstancePrivate": {
"Description": "RTPriInstance",
"Value": { "Fn::GetAtt" : [ "RTPriInstance", "PrivateIp" ]}
},
"RTSecInstancePrivate": {
"Description": "RTSecInstance",
"Value": { "Fn::GetAtt" : [ "RTSecInstance", "PrivateIp" ]}
},
"XrayInstancePrivate": {
"Description": "XrayInstance",
"Value": { "Fn::GetAtt" : [ "XrayInstance", "PrivateIp" ]}
},
"DBInstancePrivate": {
"Description": "DBInstance",
"Value": { "Fn::GetAtt" : [ "DBInstance", "PrivateIp" ]}
}
}
}

View File

@@ -0,0 +1,679 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vnetName": {
"type": "string",
"defaultValue": "vnet01",
"metadata": {
"description": "Name of new vnet to deploy into."
}
},
"vnetAddressRange": {
"type": "string",
"defaultValue": "10.0.0.0/16",
"metadata": {
"description": "IP prefix for available addresses in vnet address space."
}
},
"subnetAddressRange": {
"type": "string",
"defaultValue": "10.0.0.0/24",
"metadata": {
"description": "Subnet IP prefix MUST be within vnet IP prefix address space."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
},
"adminPublicKey": {
"type": "string",
"metadata": {
"description": "The ssh public key for the VMs."
}
},
"sizeOfDiskInGB": {
"type": "int",
"defaultValue": 128,
"minValue": 128,
"maxValue": 1024,
"metadata": {
"description": "Size of data disk in GB 128-1024"
}
},
"vmSize": {
"type": "string",
"defaultValue": "Standard_D2s_v3",
"metadata": {
"description": "Size of the VMs"
}
},
"numberOfArtifactory": {
"type": "int",
"defaultValue": 1,
"minValue": 1,
"maxValue": 5,
"metadata": {
"description": "Number of Artifactory servers."
}
},
"numberOfXray": {
"type": "int",
"defaultValue": 1,
"minValue": 1,
"maxValue": 5,
"metadata": {
"description": "Number of Xray servers."
}
},
"numberOfDb": {
"type": "int",
"defaultValue": 1,
"minValue": 1,
"maxValue": 2,
"metadata": {
"description": "Number of database servers."
}
}
},
"variables": {
"vnetName": "[parameters('vnetName')]",
"vnetAddressRange": "[parameters('vnetAddressRange')]",
"subnetAddressRange": "[parameters('subnetAddressRange')]",
"subnetName": "mainSubnet",
"loadBalancerName": "LB",
"loadBalancerIp": "lbIp",
"numberOfArtifactory": "[parameters('numberOfArtifactory')]",
"numberOfXray": "[parameters('numberOfXray')]",
"numberOfDb": "[parameters('numberOfDb')]",
"availabilitySetName": "availSet",
"vmArtPri": "vmArtPri",
"vmArtSec": "vmArtSec",
"vmXray": "vmXray",
"vmDb": "vmDb",
"storageAccountNameDiag": "[concat('diag',uniqueString(resourceGroup().id))]",
"subnet-id": "[resourceId('Microsoft.Network/virtualNetworks/subnets',variables('vnetName'),variables('subnetName'))]",
"imagePublisher": "Canonical",
"imageOffer": "UbuntuServer",
"imageSku": "16.04-LTS",
"mainNsg": "mainNsg",
"adminUsername": "ubuntu"
},
"resources": [
{
"apiVersion": "2019-08-01",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('loadBalancerIp')]",
"location": "[parameters('location')]",
"properties": {
"publicIPAllocationMethod": "Static"
}
},
{
"type": "Microsoft.Compute/availabilitySets",
"name": "[variables('availabilitySetName')]",
"apiVersion": "2019-12-01",
"location": "[parameters('location')]",
"sku": {
"name": "Aligned"
},
"properties": {
"platformFaultDomainCount": 2,
"platformUpdateDomainCount": 2
}
},
{
"apiVersion": "2019-06-01",
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('storageAccountNameDiag')]",
"location": "[parameters('location')]",
"kind": "StorageV2",
"sku": {
"name": "Standard_LRS"
}
},
{
"comments": "Simple Network Security Group for subnet [Subnet]",
"type": "Microsoft.Network/networkSecurityGroups",
"apiVersion": "2019-08-01",
"name": "[variables('mainNsg')]",
"location": "[parameters('location')]",
"properties": {
"securityRules": [
{
"name": "allow-ssh",
"properties": {
"description": "Allow SSH",
"protocol": "TCP",
"sourcePortRange": "*",
"destinationPortRange": "22",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 100,
"direction": "Inbound",
"sourcePortRanges": [],
"destinationPortRanges": [],
"sourceAddressPrefixes": [],
"destinationAddressPrefixes": []
}
},
{
"name": "allow-http",
"properties": {
"description": "Allow HTTP",
"protocol": "TCP",
"sourcePortRange": "*",
"destinationPortRange": "80",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 110,
"direction": "Inbound",
"sourcePortRanges": [],
"destinationPortRanges": [],
"sourceAddressPrefixes": [],
"destinationAddressPrefixes": []
}
}
]
}
},
{
"apiVersion": "2019-08-01",
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('vnetName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('mainNsg'))]"
],
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('vnetAddressRange')]"
]
},
"subnets": [
{
"name": "[variables('subnetName')]",
"properties": {
"addressPrefix": "[variables('subnetAddressRange')]",
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('mainNsg'))]"
}
}
}
]
}
},
{
"apiVersion": "2018-10-01",
"name": "[variables('loadBalancerName')]",
"type": "Microsoft.Network/loadBalancers",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/',variables('loadBalancerIp'))]"
],
"properties": {
"frontendIpConfigurations": [
{
"name": "LBFE",
"properties": {
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('loadBalancerIp'))]"
}
}
}
],
"backendAddressPools": [
{
"name": "LBArt"
}
],
"inboundNatRules": [
{
"name": "ssh",
"properties": {
"frontendIPConfiguration": {
"id": "[resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations',variables('loadBalancerName'),'LBFE')]"
},
"frontendPort": 22,
"backendPort": 22,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 4,
"protocol": "Tcp",
"enableTcpReset": false
}
}
],
"loadBalancingRules": [
{
"properties": {
"frontendIPConfiguration": {
"id": "[resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', variables('loadBalancerName'), 'LBFE')]"
},
"backendAddressPool": {
"id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', variables('loadBalancerName'), 'LBArt')]"
},
"probe": {
"id": "[resourceId('Microsoft.Network/loadBalancers/probes', variables('loadBalancerName'), 'lbprobe')]"
},
"protocol": "Tcp",
"frontendPort": 80,
"backendPort": 80,
"idleTimeoutInMinutes": 15
},
"name": "lbrule"
}
],
"probes": [
{
"properties": {
"protocol": "Tcp",
"port": 80,
"intervalInSeconds": 15,
"numberOfProbes": 2
},
"name": "lbprobe"
}
]
}
},
{
"apiVersion": "2019-08-01",
"type": "Microsoft.Network/networkInterfaces",
"name": "[variables('vmArtPri')]",
"location": "[parameters('location')]",
"dependsOn": [
"[variables('vnetName')]",
"[variables('loadBalancerName')]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[variables('subnet-id')]"
},
"loadBalancerBackendAddressPools": [
{
"id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools',variables('loadBalancerName'),'LBArt')]"
}
],
"loadBalancerInboundNatRules": [
{
"id": "[resourceId('Microsoft.Network/loadBalancers/inboundNatRules', variables('loadBalancerName'), 'ssh')]"
}
]
}
}
]
}
},
{
"apiVersion": "2019-08-01",
"type": "Microsoft.Network/networkInterfaces",
"name": "[concat(variables('vmArtSec'),copyindex())]",
"copy": {
"name": "netIntLoop",
"count": "[sub(variables('numberOfArtifactory'),1)]"
},
"location": "[parameters('location')]",
"dependsOn": [
"[variables('vnetName')]",
"[variables('loadBalancerName')]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[variables('subnet-id')]"
},
"loadBalancerBackendAddressPools": [
{
"id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools',variables('loadBalancerName'),'LBArt')]"
}
]
}
}
]
}
},
{
"apiVersion": "2019-08-01",
"type": "Microsoft.Network/networkInterfaces",
"name": "[concat(variables('vmXray'),copyindex())]",
"copy": {
"name": "netXrLoop",
"count": "[variables('numberOfXray')]"
},
"location": "[parameters('location')]",
"dependsOn": [
"[variables('vnetName')]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[variables('subnet-id')]"
}
}
}
]
}
},
{
"apiVersion": "2019-08-01",
"type": "Microsoft.Network/networkInterfaces",
"name": "[concat(variables('vmDb'),copyindex())]",
"copy": {
"name": "netDbLoop",
"count": "[variables('numberOfDb')]"
},
"location": "[parameters('location')]",
"dependsOn": [
"[variables('vnetName')]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[variables('subnet-id')]"
}
}
}
]
}
},
{
"apiVersion": "2019-12-01",
"type": "Microsoft.Compute/virtualMachines",
"name": "[variables('vmArtPri')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountNameDiag'))]",
"[resourceId('Microsoft.Network/networkInterfaces', variables('vmArtPri'))]",
"[resourceId('Microsoft.Compute/availabilitySets', variables('availabilitySetName'))]"
],
"properties": {
"availabilitySet": {
"id": "[resourceId('Microsoft.Compute/availabilitySets', variables('availabilitySetName'))]"
},
"hardwareProfile": {
"vmSize": "[parameters('vmSize')]"
},
"osProfile": {
"computerName": "[variables('vmArtPri')]",
"adminUsername": "[variables('adminUsername')]",
"linuxConfiguration": {
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"path": "[concat('/home/', variables('adminUsername'), '/.ssh/authorized_keys')]",
"keyData": "[parameters('adminPublicKey')]"
}
]
}
}
},
"storageProfile": {
"imageReference": {
"publisher": "[variables('imagePublisher')]",
"offer": "[variables('imageOffer')]",
"sku": "[variables('imageSku')]",
"version": "latest"
},
"osDisk": {
"createOption": "FromImage"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('vmArtPri'))]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[reference(variables('storageAccountNameDiag'), '2019-06-01').primaryEndpoints.blob]"
}
}
}
},
{
"apiVersion": "2019-12-01",
"type": "Microsoft.Compute/virtualMachines",
"name": "[concat(variables('vmArtSec'), copyindex())]",
"copy": {
"name": "virtualMachineLoop",
"count": "[sub(variables('numberOfArtifactory'),1)]"
},
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountNameDiag'))]",
"[resourceId('Microsoft.Network/networkInterfaces', concat(variables('vmArtSec'),copyindex()))]",
"[resourceId('Microsoft.Compute/availabilitySets', variables('availabilitySetName'))]"
],
"properties": {
"availabilitySet": {
"id": "[resourceId('Microsoft.Compute/availabilitySets', variables('availabilitySetName'))]"
},
"hardwareProfile": {
"vmSize": "[parameters('vmSize')]"
},
"osProfile": {
"computerName": "[concat(variables('vmArtSec'), copyindex())]",
"adminUsername": "[variables('adminUsername')]",
"linuxConfiguration": {
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"path": "[concat('/home/', variables('adminUsername'), '/.ssh/authorized_keys')]",
"keyData": "[parameters('adminPublicKey')]"
}
]
}
}
},
"storageProfile": {
"imageReference": {
"publisher": "[variables('imagePublisher')]",
"offer": "[variables('imageOffer')]",
"sku": "[variables('imageSku')]",
"version": "latest"
},
"osDisk": {
"createOption": "FromImage"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('vmArtSec'),copyindex()))]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[reference(variables('storageAccountNameDiag'), '2019-06-01').primaryEndpoints.blob]"
}
}
}
},
{
"apiVersion": "2019-12-01",
"type": "Microsoft.Compute/virtualMachines",
"name": "[concat(variables('vmXray'), copyindex())]",
"copy": {
"name": "virtualMachineLoop",
"count": "[variables('numberOfXray')]"
},
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountNameDiag'))]",
"[resourceId('Microsoft.Network/networkInterfaces', concat(variables('vmXray'),copyindex()))]",
"[resourceId('Microsoft.Compute/availabilitySets', variables('availabilitySetName'))]"
],
"properties": {
"availabilitySet": {
"id": "[resourceId('Microsoft.Compute/availabilitySets', variables('availabilitySetName'))]"
},
"hardwareProfile": {
"vmSize": "[parameters('vmSize')]"
},
"osProfile": {
"computerName": "[concat(variables('vmXray'), copyindex())]",
"adminUsername": "[variables('adminUsername')]",
"linuxConfiguration": {
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"path": "[concat('/home/', variables('adminUsername'), '/.ssh/authorized_keys')]",
"keyData": "[parameters('adminPublicKey')]"
}
]
}
}
},
"storageProfile": {
"imageReference": {
"publisher": "[variables('imagePublisher')]",
"offer": "[variables('imageOffer')]",
"sku": "[variables('imageSku')]",
"version": "latest"
},
"osDisk": {
"createOption": "FromImage"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('vmXray'),copyindex()))]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[reference(variables('storageAccountNameDiag'), '2019-06-01').primaryEndpoints.blob]"
}
}
}
},
{
"apiVersion": "2019-12-01",
"type": "Microsoft.Compute/virtualMachines",
"name": "[concat(variables('vmDb'), copyindex())]",
"copy": {
"name": "virtualMachineLoop",
"count": "[variables('numberOfDb')]"
},
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountNameDiag'))]",
"[resourceId('Microsoft.Network/networkInterfaces', concat(variables('vmDb'),copyindex()))]",
"[resourceId('Microsoft.Compute/availabilitySets', variables('availabilitySetName'))]"
],
"properties": {
"availabilitySet": {
"id": "[resourceId('Microsoft.Compute/availabilitySets', variables('availabilitySetName'))]"
},
"hardwareProfile": {
"vmSize": "[parameters('vmSize')]"
},
"osProfile": {
"computerName": "[concat(variables('vmDb'), copyindex())]",
"adminUsername": "[variables('adminUsername')]",
"linuxConfiguration": {
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"path": "[concat('/home/', variables('adminUsername'), '/.ssh/authorized_keys')]",
"keyData": "[parameters('adminPublicKey')]"
}
]
}
}
},
"storageProfile": {
"imageReference": {
"publisher": "[variables('imagePublisher')]",
"offer": "[variables('imageOffer')]",
"sku": "[variables('imageSku')]",
"version": "latest"
},
"osDisk": {
"createOption": "FromImage"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('vmDb'),copyindex()))]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[reference(variables('storageAccountNameDiag'), '2019-06-01').primaryEndpoints.blob]"
}
}
}
}
],
"outputs": {
"lbIp": {
"type": "string",
"value": "[reference(resourceId('Microsoft.Network/publicIPAddresses', variables('loadBalancerIp'))).ipAddress]"
},
"vmArtPriIp": {
"type": "string",
"value": "[reference(resourceId('Microsoft.Network/networkInterfaces', variables('vmArtPri'))).ipConfigurations[0].properties.privateIPAddress]"
},
"vmArtSecArrIp": {
"type": "array",
"copy": {
"count": "[sub(variables('numberOfArtifactory'),1)]",
"input": "[reference(resourceId('Microsoft.Network/networkInterfaces', concat(variables('vmArtSec'),copyindex()))).ipConfigurations[0].properties.privateIPAddress]"
}
},
"vmXrayArrIp": {
"type": "array",
"copy": {
"count": "[variables('numberOfXray')]",
"input": "[reference(resourceId('Microsoft.Network/networkInterfaces', concat(variables('vmXray'),copyindex()))).ipConfigurations[0].properties.privateIPAddress]"
}
},
"vmDbArrIp": {
"type": "array",
"copy": {
"count": "[variables('numberOfDb')]",
"input": "[reference(resourceId('Microsoft.Network/networkInterfaces', concat(variables('vmDb'),copyindex()))).ipConfigurations[0].properties.privateIPAddress]"
}
}
}
}