Skip to content

esxi/standard-network-mappings

Set the ESXi software install acceptance level.

This Param defines the structure of a more complete Standard vswitch/portgroup constructs on an ESXi host. The following standard ESXi network elements can be configured:

  • vswitch
  • vswitch port count
  • vswitch MTU
  • vswitch VMNIC uplinks
  • portgroups
  • portgroup vlan
  • portgroup VMK interfaces
  • portgroup VMK addressing (static, dhcp)
  • portgroup tag usage (eg Management, VSAN, etc)
  • portgroup uplink failover configuration (overriding the vswitch config values)

The backing task that processes this data structures works very hard to try and resolve issues to drive an ESXi host to the declared configuration. However, there are some limitations in the code:

  • primarily only net-new configurations will be built
  • artifacts will not be removed if they are not defined here
  • some network objects will not reconfigure if they already exist
  • if a network object is in use, it will fail to be reconfigured

These configuration changes are only supported on freshly built ESXi hosts that do not yet have any Virtual Machines consuming any of the network components. Any VM using the vSwitches or Portgroups will prevent the Task from reconfiguring the network topology of the system.

The primary goal of this Param data structure is to define the vSwitches and Portgroups that should be added to an ESXi host with it's accompanying vmnic configuration, VMKs, and VLAN mappings.

The Param structure is interpreted by the .ParamExpand golang template construct which means that some golang templating can be used to create a more reusable and dynamic data structure. The below example shows this for the static IP address assignments to reuse the existing last Octet from the DRP Machine Objects .Machine.Address field.

Please see the JSON Schema stanza for the structure definitions and explicit options that are supported by them.

Example in YAML:

  vSwitch0:
    mtu: 1500
    ports: 128
    uplinks:
      - vmnic0
    portgroups:
      Management Network:
        vlan: 0
        vmk:
          name: vmk0
          type: dhcp
          tagname: Management
  vSwitch1:
    mtu: 1500
    uplinks:
      - vmnic2
      - vmnic3
    failover:
      active_uplinks:
        - vmnic2
        - vmnic3
        - vmnic4
      failback: true
      failure_detection: beacon
      load_balancing: iphash
      notify_switches: true
      standby_uplinks:
        - vmnic4
    portgroups:
      VM Network: 
        migrate: true
        vlan: 2
        vmk:
          name: vmk1
          type: static
          address: 10.10.2.{{ last ( splitList "." ( .Machine.Address | toString ) ) }}
          netmask: 255.255.255.0
          gateway: 10.10.2.1
      VSAN:
        vlan: 3
        failover:
          load_balancing: mac
          use_vswitch: true
        vmk:
          name: vmk2
          type: static
          address: 10.10.3.{{ last ( splitList "." ( .Machine.Address | toString ) ) }}
          netmask: 255.255.255.0
          gateway: 10.10.3.1
          tagname: vSAN

Example in JSON:

  {
    "vSwitch0": {
      "mtu": 1500,
      "uplinks": [ "vmnic0" ],
      "ports": 128,
      "portgroups": {
        "Management Network": {
          "vlan": 0,
          "vmk": {
            "name": "vmk0",
            "type": "dhcp",
            "tagname": "Management"
          }
        }
      }
    },
    "vSwitch1": {
      "mtu": 1500,
      "uplinks": [ "vmnic2", "vmnic3", "vmnic4" ],
      "ports": 512,
      "failover": {
        "active_uplinks": [ "vmnic2", "vmnic3" ],
        "failback": true,
        "failure_detection": "beacon",
        "load_balancing": "iphash",
        "notify_switches": true,
        "standby_uplinks": [ "vmnic4" ]
      },
      "portgroups": {
        "VM Network": {
          "migrate": true,
          "vlan": 2,
          "vmk": {
            "name": "vmk1",
            "type": "static",
            "address": "10.10.2.{{ last ( splitList \".\" ( .Machine.Address | toString ) ) }}",
            "netmask": "255.255.255.0",
            "gateway": "10.10.2.1"
          }
        },
        "VSAN": {
          "vlan": 3,
          "failover": {
            "load_balancing": "mac",
            "use_vswitch": true
          },
          "vmk": {
            "name": "vmk2",
            "type": "static",
            "address": "10.10.3.101",
            "address": "10.10.3.{{ last ( splitList \".\" ( .Machine.Address | toString ) ) }}",
            "netmask": "255.255.255.0",
            "gateway": "10.10.3.1",
            "tagname": "vSAN"
          }
        }
      }
    }
  }