The VMware Aria Automation integration with Avi Load Balancer supports virtual service virtual IP address allocation through Avi Load Balancer IPAM. You can also specify the IP inside the template or as an input.

When designing your template, keep in mind that even though some properties might not be marked as required, they might still be necessary for your template to work, depending on your use case. The following template samples provide guidance around different IPAM, vSphere, and NSX Cloud scenarios.

In some of the template samples that use the tier1_lr attribute, the tier1_lr name can be used only when the tier 1 logical router name is the same as the ID. Otherwise, you must use the tier 1 logical router full path, for example, /infra/tier-1s/20f6a214-e8b3-4bb3-aaeb-6c06639ada23.

Before you begin

You configure Avi Load Balancer IPAM in the Avi Load Balancer Controller first, and then you configure VMware Aria Automation.
  1. In the Avi Load Balancer Controller, configure the subnet and the IPAM profile.

    See NSX Advanced Load Balancer IPAM and DNS.

  2. Configure VMware Aria Automation.
    1. Create your Avi Load Balancer cloud account in Automation Assembler, create a project, and add the cloud zone.

      See Create a VMware Avi Load Balancer cloud account.

    2. Configure the network for provisioning.

      Navigate to Infrastructure > Resources > Networks, locate the network to be used for provisioning, and configure the IPv4/IPv6 CIDR and DNS servers.

      See Network resources in VMware Aria Automation.

    3. Configure the image mapping.

      Navigate to Infrastructure > Configure > Image Mappings and follow the onscreen prompts to create a new image mapping.

      See Learn more about image mappings in VMware Aria Automation.

    4. Configure the network profile.

      Navigate to Infrastructure > Configure > Network Profiles and follow the onscreen prompts to create a new network profile.

      See Learn more about network profiles in VMware Aria Automation.

Static IP address in VS VIP

This Avi Load Balancer sample template includes a virtual service, a VS VIP, and a pool. A vSphere virtual machine cluster is assigned to the pool. The VS VIP has a static IP address.

formatVersion: 1
inputs:
  count:
    type: integer
    title: vm-count
    default: 2
resources:
  Idem_AVILB_APPLICATIONS_POOL_1:
    type: Idem.AVILB.APPLICATIONS.POOL
    properties:
      name: pool-${uuid()}
      account: Avi
      default_server_port: 8000
      networks:
        - network_ref: ${resource.Cloud_vSphere_Network_1.resourceName}
      health_monitor_refs:
        - System-HTTP
      servers: ${map_to_object(resource.Cloud_vSphere_Machine_1[*].address, "ip", "addr")}
  Idem_AVILB_APPLICATIONS_VIRTUAL_SERVICE_1:
    type: Idem.AVILB.APPLICATIONS.VIRTUAL_SERVICE
    properties:
      name: vs-${uuid()}
      account: Avi
      traffic_enabled: true
      services:
        - port: 8000
      pool_ref: ${resource.Idem_AVILB_APPLICATIONS_POOL_1.name}
      vsvip_ref: ${resource.Idem_AVILB_APPLICATIONS_VS_VIP_1.name}
  Idem_AVILB_APPLICATIONS_VS_VIP_1:
    type: Idem.AVILB.APPLICATIONS.VS_VIP
    properties:
      name: vip-${uuid()}
      account: Avi
      vip:
        - enabled: true
          ip_address:
            addr: 10.202.20.80
            type: V4
  Cloud_vSphere_Machine_1:
    type: Cloud.vSphere.Machine
    properties:
      count: ${input.count}
      image: webserver
      cpuCount: 1
      totalMemoryMB: 1024
      networks:
        - network: ${resource.Cloud_vSphere_Network_1.id}
          assignment: static
  Cloud_vSphere_Network_1:
    type: Cloud.vSphere.Network
    properties:
      networkType: existing

Avi Load Balancer IPAM in VS VIP for vCenter cloud

This Avi Load Balancer sample template is for vCenter cloud.

The VS VIP resource defines the ipam_network_subnet section with network ref and subnet. This definition makes Avi Load Balancer to allocate an IP address from the defined Avi Load Balancer IPAM profile when creating the VS VIP in the Avi Load Balancer Controller.

The defined cluster of pool members use a static network assignment. In Automation Assembler, you configure a network, for example, Domain, IPv4/IPv6 CIDR, a default gateway, and DNS servers. Then, you set up a network profile with a network range using this network. When clusters are created, the IP addresses from the network range are allocated to the clusters.

inputs:
  count:
    type: integer
    title: count
    default: 2
resources:
  Allocations_CustomNaming_1:
    type: Allocations.CustomNaming
    properties:
      resourceType: Generic
      numberOfNamesToGenerate: 5
      templateName: aviBP
  Idem_AVILB_PROFILES_HEALTH_MONITOR_1:
    type: Idem.AVILB.PROFILES.HEALTH_MONITOR
    properties:
      name: test-mon-${resource.Allocations_CustomNaming_1.selectedNames[0]}
      type: HEALTH_MONITOR_PING
      account: aviAcct
      is_federated: false
      monitor_port: 8000
      send_interval: 8
      receive_timeout: 4
      successful_checks: 4
      failed_checks: 4
  Idem_AVILB_APPLICATIONS_POOL_1:
    type: Idem.AVILB.APPLICATIONS.POOL
    metadata:
      layoutPosition:
        - 0
        - 2
    properties:
      name: test-pool-${resource.Allocations_CustomNaming_1.selectedNames[0]}
      account: aviAcct
      lb_algorithm: LB_ALGORITHM_ROUND_ROBIN
      default_server_port: 8000
      networks:
        - network_ref: ${resource.Cloud_vSphere_Network_1.resourceName}
      health_monitor_refs:
        - ${resource.Idem_AVILB_PROFILES_HEALTH_MONITOR_1.name}
      servers: ${map_to_object(resource.Cloud_vSphere_Machine_1[*].address, "ip", "addr")}
  Idem_AVILB_APPLICATIONS_VIRTUAL_SERVICE_1:
    type: Idem.AVILB.APPLICATIONS.VIRTUAL_SERVICE
    properties:
      name: test-vs-${resource.Allocations_CustomNaming_1.selectedNames[0]}
      account: aviAcct
      cloud_type: CLOUD_NONE
      type: VS_TYPE_NORMAL
      traffic_enabled: true
      services:
        - enable_ssl: false
          port: 8000
      pool_ref: ${resource.Idem_AVILB_APPLICATIONS_POOL_1.name}
      vsvip_ref: ${resource.Idem_AVILB_APPLICATIONS_VS_VIP_1.name}
  Cloud_vSphere_Machine_1:
    type: Cloud.vSphere.Machine
    properties:
      count: ${input.count}
      image: webserver
      cpuCount: 1
      totalMemoryMB: 1024
      networks:
        - network: ${resource.Cloud_vSphere_Network_1.id}
          assignment: static
  Cloud_vSphere_Network_1:
    type: Cloud.vSphere.Network
    metadata:
      layoutPosition:
        - 2
        - 0
    properties:
      networkType: existing
  Idem_AVILB_APPLICATIONS_VS_VIP_1:
    type: Idem.AVILB.APPLICATIONS.VS_VIP
    properties:
      name: test-vip-${resource.Allocations_CustomNaming_1.selectedNames[0]}
      account: aviAcct
      vip:
        - auto_allocate_floating_ip: false
          auto_allocate_ip: true
          auto_allocate_ip_type: V4_ONLY
          avi_allocated_fip: false
          avi_allocated_vip: false
          enabled: true
          ipam_network_subnet:
            network_ref: ${resource.Cloud_vSphere_Network_1.resourceName}
            subnet:
              ip_addr:
                addr: 10.202.20.0
                type: V4
              mask: 22

Avi Load Balancer IPAM in VS VIP for NSX Cloud

This sample Avi Load Balancer template is for Avi Load Balancer in NSX Cloud.

To provision Avi Load Balancer on NSX Cloud, a tier 1 logical router must be defined (tier1_lr) and/or a VRF context (vrf_context_ref) in the Avi Load Balancer pool, virtual service, and VS VIP resources.

The VS VIP resource defines the ipam_network_subnet section with network ref and subnet. This definition makes Avi Load Balancer to allocate an IP address from the defined Avi Load Balancer IPAM profile when creating the VS VIP in the Avi Load Balancer Controller.

formatVersion: 1
inputs: {}
resources:
  Allocations_CustomNaming_1:
    type: Allocations.CustomNaming
    properties:
      resourceType: Generic
      numberOfNamesToGenerate: 5
      templateName: avinsxBP
  Cloud_vSphere_Machine_1:
    type: Cloud.vSphere.Machine
    properties:
      count: 2
      image: webserver
      cpuCount: 1
      totalMemoryMB: 1024
      networks:
        - network: ${resource.Cloud_vSphere_Network_1.id}
          assignment: static
  Idem_AVILB_APPLICATIONS_VS_VIP_1:
    type: Idem.AVILB.APPLICATIONS.VS_VIP
    properties:
      name: test-vip-${resource.Allocations_CustomNaming_1.selectedNames[0]}
      account: avinsx
      tier1_lr: DONT-DELETE-AVI-Admin-E2E
      vrf_context_ref: T1-DONT-DELETE-AVI-Admin-E2E
      vip:
        - auto_allocate_floating_ip: false
          auto_allocate_ip: true
          auto_allocate_ip_type: V4_ONLY
          avi_allocated_fip: false
          avi_allocated_vip: false
          enabled: true
          ipam_network_subnet:
            network_ref: ${resource.Cloud_vSphere_Network_1.resourceName}
            subnet:
              ip_addr:
                addr: 192.168.223.0
                type: V4
              mask: 24
  Idem_AVILB_APPLICATIONS_VIRTUAL_SERVICE_1:
    type: Idem.AVILB.APPLICATIONS.VIRTUAL_SERVICE
    properties:
      name: test-vs-${resource.Allocations_CustomNaming_1.selectedNames[0]}
      account: avinsx
      cloud_type: CLOUD_NONE
      type: VS_TYPE_NORMAL
      traffic_enabled: true
      vrf_context_ref: T1-DONT-DELETE-AVI-Admin-E2E
      services:
        - enable_ssl: false
          port: 80
          port_range_end: 8000
      pool_ref: ${resource.Idem_AVILB_APPLICATIONS_POOL_1.name}
      vsvip_ref: ${resource.Idem_AVILB_APPLICATIONS_VS_VIP_1.name}
  Idem_AVILB_APPLICATIONS_POOL_1:
    type: Idem.AVILB.APPLICATIONS.POOL
    properties:
      name: test-pool-${resource.Allocations_CustomNaming_1.selectedNames[0]}
      account: avinsx
      lb_algorithm: LB_ALGORITHM_ROUND_ROBIN
      tier1_lr: DONT-DELETE-AVI-Admin-E2E
      vrf_ref: T1-DONT-DELETE-AVI-Admin-E2E
      health_monitor_refs:
        - System-Ping
      servers: ${map_to_object(resource.Cloud_vSphere_Machine_1[*].address, "ip", "addr")}
  Cloud_vSphere_Network_1:
    type: Cloud.vSphere.Network
    properties:
      networkType: existing

Infoblox IPAM in VS VIP for NSX Cloud

This sample Avi Load Balancer template is based on the Avi Load Balancer integration with Infoblox. The template uses Infoblox IPAM allocate an IP address to the VS VIP for Avi Load Balancer in NSX Cloud.

The network_ref attribute of the ipam_network_subnet section in the template is set to the full path of the network segment defined in Infoblox. Note that the network_ref value must be a full path, including the /api/network/ prefix. This is different from other ref attributes.

formatVersion: 1
inputs:
  count:
    type: integer
    title: count
    default: 2
resources:
  Idem_AVILB_APPLICATIONS_VIRTUAL_SERVICE_1:
    type: Idem.AVILB.APPLICATIONS.VIRTUAL_SERVICE
    properties:
      name: infoblox-vs-${uuid()}
      account: aviinfoblox
      vrf_context_ref: nested-T1
      services:
        - port: 8000
      vsvip_ref: ${resource.Idem_AVILB_APPLICATIONS_VS_VIP_1.name}
      pool_ref: ${resource.Idem_AVILB_APPLICATIONS_POOL_1.name}
  Idem_AVILB_APPLICATIONS_VS_VIP_1:
    type: Idem.AVILB.APPLICATIONS.VS_VIP
    properties:
      name: infoblox-vip-${uuid()}
      account: aviinfoblox
      vrf_context_ref: nested-T1
      tier1_lr: nested-T1
      vip:
        - auto_allocate_ip: true
          ipam_network_subnet:
            network_ref: /api/network/infoblox--default--192.168.225.0-24
  Idem_AVILB_APPLICATIONS_POOL_1:
    type: Idem.AVILB.APPLICATIONS.POOL
    properties:
      name: infoblox-pool-${uuid()}
      account: aviinfoblox
      tier1_lr: nested-T1
      default_server_port: 8000
      health_monitor_refs:
        - System-HTTP
      servers: ${map_to_object(resource.Cloud_vSphere_Machine_1[*].address, "ip", "addr")}
  Cloud_vSphere_Machine_1:
    type: Cloud.vSphere.Machine
    properties:
      count: ${input.count}
      image: webserver
      cpuCount: 2
      totalMemoryMB: 4096
      networks:
        - network: ${resource.Cloud_NSX_Network_1.id}
          assignment: static
  Cloud_NSX_Network_1:
    type: Cloud.NSX.Network
    properties:
      networkType: existing

Existing NSX security group for pool members

This sample Avi Load Balancer template uses an existing NSX security group to assign pool members.

The nsx_securitygroup attribute is defined and set to the existing NSX security group name in the Idem.AVILB.APPLICATIONS.POOL resource.

formatVersion: 1
inputs:
  count:
    type: integer
    title: vm-count
    default: 2
resources:
  Idem_AVILB_APPLICATIONS_VS_VIP_1:
    type: Idem.AVILB.APPLICATIONS.VS_VIP
    properties:
      name: vip-sg-${uuid()}
      account: ${resource.Allocations_CloudZone_1.selectedCloudAccount.name}
      tier1_lr: DONT-DELETE-AVI-Admin-E2E
      vrf_context_ref: T1-DONT-DELETE-AVI-Admin-E2E
      vip:
        - auto_allocate_floating_ip: false
          auto_allocate_ip: true
          enabled: true
          auto_allocate_ip_type: V4_ONLY
          ipam_network_subnet:
            network_ref: SEG-DONT-DELETE-AVI-Admin-E2E-Two-Arm-VSVIP
            subnet:
              ip_addr:
                addr: 192.168.223.0
                type: V4
              mask: 24
  Allocations_CloudZone_1:
    type: Allocations.CloudZone
    properties:
      accountType: avilb
      constraints:
        - tag: avi-nsx
  Idem_AVILB_APPLICATIONS_VIRTUAL_SERVICE_1:
    type: Idem.AVILB.APPLICATIONS.VIRTUAL_SERVICE
    properties:
      name: vs-sg-${uuid()}
      account: ${resource.Allocations_CloudZone_1.selectedCloudAccount.name}
      vrf_context_ref: T1-DONT-DELETE-AVI-Admin-E2E
      traffic_enabled: true
      services:
        - port: 8000
      vsvip_ref: ${resource.Idem_AVILB_APPLICATIONS_VS_VIP_1.name}
      pool_ref: ${resource.Idem_AVILB_APPLICATIONS_POOL_1.name}
  Idem_AVILB_APPLICATIONS_POOL_1:
    type: Idem.AVILB.APPLICATIONS.POOL
    properties:
      name: pool-sg-${uuid()}
      account: ${resource.Allocations_CloudZone_1.selectedCloudAccount.name}
      tier1_lr: DONT-DELETE-AVI-Admin-E2E
      vrf_ref: T1-DONT-DELETE-AVI-Admin-E2E
      lb_algorithm: LB_ALGORITHM_ROUND_ROBIN
      health_monitor_refs:
        - System-Ping
      nsx_securitygroup:
        - avinsxgroup

Two distinct machine clusters in a single pool

This sample Avi Load Balancer template has two server clusters, Cloud_vSphere_Machine_1 (count = 2) and Cloud_vSphere_Machine_2 (count=3), assigned to the pool. The servers property definition in the Idem pool differs from the regular binding properties. It connects the addresses of the two server clusters when calling the map_to_object function in the following way:
${map_to_object(resource.Cloud_vSphere_Machine_1[*].address + resource.Cloud_vSphere_Machine_2[*].address, "ip", "addr")}

Other components, like the virtual service, VS VIP, health monitor, and cloud zone allocation helper are used in the regular way.

formatVersion: 1
inputs: {}
resources:
  Idem_AVILB_PROFILES_HEALTH_MONITOR_1:
    type: Idem.AVILB.PROFILES.HEALTH_MONITOR
    properties:
      name: monitor-${resource.Allocations_CustomNaming_1.selectedNames[0]}
      type: HEALTH_MONITOR_PING
      account: ${resource.Allocations_CloudZone_1.selectedCloudAccount.name}
      is_federated: false
      monitor_port: 8000
      send_interval: 8
      receive_timeout: 4
      successful_checks: 4
      failed_checks: 4
  Allocations_CloudZone_1:
    type: Allocations.CloudZone
    properties:
      accountType: avilb
      constraints:
        - tag: avi-vcenter
  Idem_AVILB_APPLICATIONS_POOL_1:
    type: Idem.AVILB.APPLICATIONS.POOL
    properties:
      name: pool-${resource.Allocations_CustomNaming_1.selectedNames[0]}
      account: ${resource.Allocations_CloudZone_1.selectedCloudAccount.name}
      lb_algorithm: LB_ALGORITHM_ROUND_ROBIN
      default_server_port: 8000
      servers: ${map_to_object(resource.Cloud_vSphere_Machine_1[*].address +  resource.Cloud_vSphere_Machine_2[*].address, "ip", "addr")}
      health_monitor_refs:
        - ${resource.Idem_AVILB_PROFILES_HEALTH_MONITOR_1.name}
  Idem_AVILB_APPLICATIONS_VS_VIP_1:
    type: Idem.AVILB.APPLICATIONS.VS_VIP
    properties:
      name: vip-${resource.Allocations_CustomNaming_1.selectedNames[0]}
      account: ${resource.Allocations_CloudZone_1.selectedCloudAccount.name}
      vip:
        - auto_allocate_ip: true
          auto_allocate_ip_type: V4_ONLY
          enabled: true
          placement_networks:
            - network_ref: ${resource.Cloud_vSphere_Network_1.resourceName}
              subnet:
                ip_addr:
                  addr: 10.202.20.0
                  type: V4
                mask: 22
  Allocations_CustomNaming_1:
    type: Allocations.CustomNaming
    properties:
      resourceType: Generic
      numberOfNamesToGenerate: 1
      templateName: avi-vcenter-bp
  Idem_AVILB_APPLICATIONS_VIRTUAL_SERVICE_1:
    type: Idem.AVILB.APPLICATIONS.VIRTUAL_SERVICE
    properties:
      name: vs-${resource.Allocations_CustomNaming_1.selectedNames[0]}
      account: ${resource.Allocations_CloudZone_1.selectedCloudAccount.name}
      traffic_enabled: true
      services:
        - port: 8000
      pool_ref: ${resource.Idem_AVILB_APPLICATIONS_POOL_1.name}
      vsvip_ref: ${resource.Idem_AVILB_APPLICATIONS_VS_VIP_1.name}
  Cloud_vSphere_Machine_1:
    type: Cloud.vSphere.Machine
    properties:
      count: 2
      image: photon
      cpuCount: 1
      totalMemoryMB: 1024
      networks:
        - network: ${resource.Cloud_vSphere_Network_1.id}
          assignment: static
  Cloud_vSphere_Machine_2:
    type: Cloud.vSphere.Machine
    properties:
      count: 3
      image: photon
      cpuCount: 1
      totalMemoryMB: 1024
      networks:
        - network: ${resource.Cloud_vSphere_Network_1.id}
          assignment: static
  Cloud_vSphere_Network_1:
    type: Cloud.vSphere.Network
    properties:
      networkType: existing