VMware Aria Automation 与 Avi Load Balancer 的集成支持通过 Avi Load Balancer IPAM 分配虚拟服务虚拟 IP 地址。还可以在模板中指定 IP 或将其指定为输入。
请注意,在设计模板时,即使某些属性可能未标记为必需属性,可能仍需要这些属性模板才能正常工作,具体取决于您的用例。以下模板示例提供了有关不同 IPAM、vSphere 和 NSX Cloud 场景的指导。
在使用 tier1_lr
属性的某些模板示例中,仅当第 1 层逻辑路由器名称与 ID 相同时,才能使用 tier1_lr
名称。否则,必须使用第 1 层逻辑路由器完整路径,例如,/infra/tier-1s/20f6a214-e8b3-4bb3-aaeb-6c06639ada23。
开始之前
- 在 Avi Load Balancer Controller 中,配置子网和 IPAM 配置文件。
- 配置 VMware Aria Automation。
- 在 Automation Assembler 中创建 Avi Load Balancer 云帐户,创建项目,然后添加云区域。
- 为置备配置网络。
导航到
,找到要用于置备的网络,然后配置 IPv4/IPv6 CIDR 和 DNS 服务器。 - 配置映像映射。
导航到
,然后按照屏幕上的提示创建新的映像映射。 - 配置网络配置文件。
导航到
,然后按照屏幕上的提示创建新的网络配置文件。
VS VIP 中的静态 IP 地址
此 Avi Load Balancer 示例模板包括虚拟服务、VS VIP 和池。为池分配 vSphere 虚拟机集群。VS VIP 具有静态 IP 地址。
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
在 VS VIP 中定义 Avi Load Balancer IPAM(适用于 vCenter 云)
此 Avi Load Balancer 示例模板适用于 vCenter 云。
VS VIP 资源定义了 ipam_network_subnet
部分,其中包含 network ref
和 subnet
。进行此定义后,在 Avi Load Balancer Controller 中创建 VS VIP 时,Avi Load Balancer 可从定义的 Avi Load Balancer IPAM 配置文件分配 IP 地址。
定义的池成员集群使用静态网络分配。在 Automation Assembler 中,您需要配置网络,例如,域、IPv4/IPv6 CIDR、默认网关和 DNS 服务器。然后,使用此网络设置具有网络范围的网络配置文件。创建集群时,网络范围内的 IP 地址将分配给集群。
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
在 VS VIP 中定义 Avi Load Balancer IPAM(适用于 NSX Cloud)
此示例 Avi Load Balancer 模板适用于 NSX Cloud 中的 Avi Load Balancer。
要在 NSX Cloud 上置备 Avi Load Balancer,必须在 Avi Load Balancer 池、虚拟服务和 VS VIP 资源中定义第 1 层逻辑路由器 (tier1_lr
) 和/或 VRF 上下文 (vrf_context_ref
)。
VS VIP 资源定义了 ipam_network_subnet
部分,其中包含 network ref
和 subnet
。进行此定义后,在 Avi Load Balancer Controller 中创建 VS VIP 时,Avi Load Balancer 可从定义的 Avi Load Balancer IPAM 配置文件分配 IP 地址。
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
在 VS VIP 中定义 Infoblox IPAM(适用于 NSX Cloud)
此示例 Avi Load Balancer 模板基于 Avi Load Balancer 与 Infoblox 的集成。该模板使用 Infoblox IPAM 为 NSX Cloud 中 Avi Load Balancer 的 VS VIP 分配 IP 地址。
模板中 ipam_network_subnet
部分的 network_ref
属性设置为 Infoblox 中所定义网络分段的完整路径。请注意,network_ref
值必须是包括 /api/network/
前缀的完整路径。其他 ref
属性没有此要求。
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
对池成员使用现有 NSX 安全组
此示例 Avi Load Balancer 模板使用现有 NSX 安全组分配池成员。
定义了 nsx_securitygroup
属性,并设置为 Idem.AVILB.APPLICATIONS.POOL
资源中的现有 NSX 安全组名称。
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
单个池中有两个不同的计算机集群
servers
属性定义不同于常规绑定属性。调用 map_to_object 函数时,它会按以下方式连接两个服务器集群的地址:
${map_to_object(resource.Cloud_vSphere_Machine_1[*].address + resource.Cloud_vSphere_Machine_2[*].address, "ip", "addr")}
其他组件(如虚拟服务、VS VIP、运行状况监控器和云区域分配帮助程序)以常规方式使用。
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