VMware Aria Automation 與 Avi Load Balancer 的整合支援透過 Avi Load Balancer IPAM 配置虛擬服務虛擬 IP 位址。還可以在範本中指定 IP 或將其指定為輸入。
請注意,在設計範本時,即使某些內容可能未標記為必需內容,可能仍需要這些內容才能使範本正常工作,具體取決於您的使用案例。以下範本範例提供了有關不同 IPAM、vSphere 和 NSX Cloud 案例的指引。
在使用 tier1_lr
屬性的某些範本範例中,僅當第 1 層邏輯路由器名稱與識別碼相同時,才能使用 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