Skip to content

Commit

Permalink
Fixes for 30.x and ansible config
Browse files Browse the repository at this point in the history
  • Loading branch information
slarimore02 committed Jun 7, 2024
1 parent 48235c3 commit ed6021f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# AVI Controller Deployment on vSphere Terraform module
This Terraform module creates and configures an AVI (NSX Advanced Load-Balancer) Controller on vSphere
# Avi Load Balancer Controller Deployment on vSphere Terraform module
This Terraform module creates and configures an Avi Advanced Load-Balancer Controller on vSphere

## Module Functions
The module is meant to be modular and can create all or none of the prerequiste resources needed for the AVI vSphere Deployment including:
The module is meant to be modular and can create all or none of the prerequiste resources needed for the Avi vSphere Deployment including:
* vSphere Roles for Avi (optional with create_role variable)
* vSphere virtual machines for Avi Controller(s)
* Cluster Anti-Affinity rules for HA Avi Controller Deployment
Expand Down Expand Up @@ -281,14 +281,14 @@ The controller_size variable can be used to determine the vCPU and Memory resour

| Size | vCPU Cores | Memory (GB)|
|------|-----------|--------|
| small | 8 | 24 |
| medium | 16 | 32 |
| large | 24 | 48 |
| small | 6 | 32 |
| medium | 10 | 32 |
| large | 16 | 48 |

Additional resources on sizing the Avi Controller:

https://avinetworks.com/docs/latest/avi-controller-sizing/
https://avinetworks.com/docs/latest/system-limits/
https://docs.vmware.com/en/VMware-NSX-Advanced-Load-Balancer/30.1/Installation-Guide/GUID-6366FAA5-8FDF-4B0F-B170-1D846B6CAF86.html
https://docs.vmware.com/en/VMware-NSX-Advanced-Load-Balancer/30.1/Installation-Guide/GUID-EDCC0BE7-C694-477E-B445-8EAA684792B9.html

## Day 1 Ansible Configuration and Avi Resource Cleanup
The module copies and runs an Ansible play for configuring the initial day 1 Avi config. The plays listed below can be reviewed by connecting to the Avi Controller by SSH. In an HA setup the first controller will have these files.
Expand Down
7 changes: 4 additions & 3 deletions files/ansible/avi-vsphere-all-in-one-play.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@
vcenter_url: "{{ vsphere_server }}"
privilege: WRITE_ACCESS
datacenter: "{{ vm_datacenter }}"
%{ if (split(".", avi_version)[0] == "22") || (split(".", avi_version)[0] == "21" && split(".", avi_version)[2] >= 6) ~}
%{ if (split(".", avi_version)[0] == "30") || (split(".", avi_version)[0] == "22") || (split(".", avi_version)[0] == "21" && split(".", avi_version)[2] >= 6) ~}
use_content_lib: "{{ use_content_lib }}"
%{ if use_content_lib ~}
content_lib:
Expand All @@ -383,6 +383,7 @@
avi_api_update_method: patch
avi_api_patch_op: add
name: "{{ cloud_name }}"
vtype: CLOUD_VCENTER
vcenter_configuration:
management_network: "{{ mgmt_network.obj.results.0.url }}"
%{ if configure_se_mgmt_network ~}
Expand Down Expand Up @@ -855,9 +856,9 @@
type: V4
addr: "{{ controller_ip[2] }}"
%{ if configure_gslb.enabled ~}
name: "{{ name_prefix }}-{{ configure_gslb.site_name }}-cluster"
name: "{{ name_prefix }}-{{ configure_gslb.site_name }}-cluster"
%{ else ~}
name: "{{ name_prefix }}-cluster"
name: "{{ name_prefix }}-cluster"
%{ endif ~}
virtual_ip: "{{ cluster_ip if cluster_ip.addr != '' else omit }}"
tenant_uuid: "admin"
Expand Down
11 changes: 6 additions & 5 deletions vsphere-vm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ locals {
ca_certificates = var.ca_certificates
}
controller_sizes = {
small = [8, 24576]
medium = [16, 32768]
large = [24, 49152]
small = [6, 32768]
medium = [10, 32768]
large = [16, 49152]
}

controller_names = vsphere_virtual_machine.avi_controller[*].name
controller_ips = var.controller_ha ? [var.controller_ip[0], var.controller_ip[1], var.controller_ip[2]] : [var.controller_ip[0]]
controller_info = zipmap(vsphere_virtual_machine.avi_controller[*].name, local.controller_ips)
Expand Down Expand Up @@ -87,13 +88,13 @@ resource "vsphere_compute_cluster_vm_anti_affinity_rule" "avi" {
count = var.controller_ha ? 1 : 0
name = "${var.name_prefix}-avi-controller-vm-anti-affinity-rule"
compute_cluster_id = data.vsphere_compute_cluster.avi[0].id
virtual_machine_ids = vsphere_virtual_machine.avi_controller.*.id
virtual_machine_ids = vsphere_virtual_machine.avi_controller[*].id
mandatory = "true"
}
resource "null_resource" "ansible_provisioner" {
# Changes to any instance of the cluster requires re-provisioning
triggers = {
controller_instance_ids = join(",", vsphere_virtual_machine.avi_controller.*.name)
controller_instance_ids = join(",", vsphere_virtual_machine.avi_controller[*].name)
}
connection {
type = "ssh"
Expand Down

0 comments on commit ed6021f

Please sign in to comment.