nsxt_logical_switches – Create a Logical Switch

New in version 2.7.

Synopsis

  • Creates a new logical switch. The request must include the transport_zone_id, display_name, and admin_state (UP or DOWN). The replication_mode (MTEP or SOURCE) is required for overlay logical switches, but not for VLAN-based logical switches. A vlan needs to be provided for VLAN-based logical switches

Parameters

Parameter Choices/Defaults Comments
address_bindings
array of PacketAddressClassifier
Address bindings for the Logical switch
admin_state
string / required
Represents Desired state of the Logical Switch
description
string
Description of the resource
display_name
string / required
Display name
extra_configs
array of ExtraConfig
This property could be used for vendor specific configuration in key value string pairs, the setting in extra_configs will be automatically inheritted by logical ports in the logical switch.
hostname
string / required
Deployed NSX manager hostname.
hybrid
boolean
If this flag is set to true, then all the logical switch ports attached to this logical switch will behave in a hybrid fashion. The hybrid logical switch port indicates to NSX that the VM intends to operate in underlay mode, but retains the ability to forward egress traffic to the NSX overlay network. This flag can be enabled only for the logical switches in the overlay type transport zone which has host switch mode as STANDARD and also has either CrossCloud or CloudScope tag scopes. Only the NSX public cloud gateway (PCG) uses this flag, other host agents like ESX, KVM and Edge will ignore it. This property cannot be modified once the logical switch is created.
ip_pool_name
string
IP pool name
lswitch_id
string
LSwitch ID
mac_pool_id
string
Mac pool id that associated with a LogicalSwitch.
mac_pool_name
string
Mac pool name that associated with a LogicalSwitch.
password
string / required
The password to authenticate with the NSX manager.
replication_mode
string
Replication mode of the Logical Switch
span
list
List of Local Manager IDs the logical switch extends
state
- / required
    Choices:
  • present
  • absent
State can be either 'present' or 'absent'. 'present' is used to create or update resource. 'absent' is used to delete resource.
switch_type
string
This readonly field indicates purpose of a LogicalSwitch. It is set by manager internally and any user provided values will not be honored. DEFAULT type LogicalSwitches are created for basic L2 connectivity by API users. SERVICE_PLANE type LogicalSwitches are system created service plane LogicalSwitches Service Insertion service.
switching_profiles
list
List of Switching Profile Names and type
tags
list
Opaque identifiers meaningful to the API user
transport_zone_name
string / required
Transport Zone Name
uplink_teaming_policy_name
string
This name has to be one of the switching uplink teaming policy names listed inside the logical switch's TransportZone. If this field is not specified, the logical switch will not have a teaming policy associated with it and the host switch's default teaming policy will be used.
username
string / required
The username to authenticate with the NSX manager.
vlan
integer
This property is dedicated to VLAN based network, to set VLAN of logical network. It is mutually exclusive with 'vlan_trunk_spec'.
vlan_trunk_spec
dictionary
This property is used for VLAN trunk specification of logical switch. It's mutually exclusive with 'vlan'. Also it could be set to do guest VLAN tagging in overlay network.
vni
integer
Only for OVERLAY network. A VNI will be auto-allocated from the default VNI pool if not given; otherwise the given VNI has to be inside the default pool and not used by any other LogicalSwitch.

Examples

- name: Create logical switch
  nsxt_logical_switches:
    hostname: "10.192.167.137"
    username: "admin"
    password: "Admin!23Admin"
    validate_certs: False
    display_name: "test_lswitch"
    replication_mode: "SOURCE"
    admin_state: "UP"
    transport_zone_name: "TZ1"
    state: "present"

Status

  • This module is not guaranteed to have a backwards compatible interface. [preview]

  • This module is maintained by the Ansible Community. [community]

Authors

  • Rahul Raghuvanshi