fortiswitch_switch_vlan – Configure optional per-VLAN settings in Fortinet’s FortiSwitch

New in version 1.0.0.

Synopsis

  • This module is able to configure a FortiSwitch device by allowing the user to set and modify switch feature and vlan category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v7.0.0

Requirements

The below requirements are needed on the host that executes this module.

  • ansible>=2.14

FortiSW Version Compatibility


Supported Version Ranges
fortiswitch_switch_vlan v7.0.0 -> latest

Parameters

  • enable_log - Enable/Disable logging for task. type: bool required: false default: False
  • member_path - Member attribute path to operate on. type: str
  • member_state - Add or delete a member under specified attribute path. type: str choices: present, absent
  • state - Indicates whether to create or remove the object. type: str required: true choices: present, absent
  • switch_vlan - Configure optional per-VLAN settings. type: dict
    • access_vlan - Block port-to-port traffic. type: str choices: disable, enable
    • arp_inspection - Enable/Disable Dynamic ARP Inspection. type: str choices: disable, enable
    • assignment_priority - 802.1x Radius (Tunnel-Private-Group-Id) vlanid assign-by-name priority (smaller is higher). type: int
    • community_vlans - Communities within this private VLAN. type: str
    • cos_queue - Set cos(0-7) on the VLAN traffic or unset to disable. type: int
    • description - Description. type: str
    • dhcp6_snooping - Enable/Disable DHCPv6 snooping on this vlan. type: str choices: disable, enable
    • dhcp_server_access_list - Configure dhcp server access list. type: list
      • name - User given name for dhcp-server. type: str
      • server_ip - IP address for DHCP Server. type: str
      • server_ip6 - IP address for DHCPv6 Server. type: str
    • dhcp_snooping - Enable/Disable dhcp snooping on this vlan. type: str choices: disable, enable
    • dhcp_snooping_option82 - Enable/Disable inserting option82. type: str choices: disable, enable
    • dhcp_snooping_static_client - DHCP Snooping static clients. type: list
      • ip_addr - Client IPv4 address. type: str
      • mac_addr - Client MAC address. type: str
      • name - Client Name. type: str
      • switch_interface - Interface name. type: str
    • dhcp_snooping_verify_mac - Enable/Disable verify source mac. type: str choices: disable, enable
    • id - VLAN ID. type: int required: true
    • igmp_snooping - Enable/disable IGMP-snooping for the VLAN interface. type: str choices: enable, disable
    • igmp_snooping_fast_leave - Enable/disable IGMP snooping fast leave. type: str choices: enable, disable
    • igmp_snooping_proxy - Enable/disable IGMP snooping proxy for the VLAN interface. type: str choices: enable, disable
    • igmp_snooping_querier - Enable/disable IGMP-snooping-querier for the VLAN interface. type: str choices: enable, disable
    • igmp_snooping_querier_addr - IGMP-snooping-querier address. type: str
    • igmp_snooping_querier_version - IGMP-snooping-querier version. type: int
    • igmp_snooping_static_group - IGMP static groups. type: list
      • ignore_reports - Enable/disable to ignore all IGMP membership reports received for this group. type: str choices: enable, disable
      • mcast_addr - Multicast address for static-group. type: str
      • members - Member interfaces. type: list
        • member_name - Interface name. type: str
      • name - Group name. type: str
    • isolated_vlan - Isolated VLAN. type: int
    • lan_segment - Enable/disable LAN Segment. type: str choices: enable, disable
    • lan_segment_primary_vlan - LAN Segment Primary VLAN ID. type: int
    • lan_segment_type - LAN segment type. type: int
    • lan_subvlans - LAN segment subvlans. type: str
    • learning - Enable/disable L2 learning on this VLAN. type: str choices: disable, enable
    • learning_limit - Limit the number of dynamic MAC addresses on this VLAN. type: int
    • member_by_ipv4 - Assign VLAN membership based on IPv4 address or subnet. type: list
      • address - Address(/32) or subnet. type: str
      • description - Description. type: str
      • id - Entry ID. type: int
    • member_by_ipv6 - Assign VLAN membership based on IPv6 prefix. type: list
      • description - Description. type: str
      • id - Entry ID. type: int
      • prefix - IPv6 prefix (max = /64). type: str
    • member_by_mac - Assign VLAN membership based on MAC address. type: list
      • description - Description. type: str
      • id - Entry ID. type: int
      • mac - MAC address. type: str
    • member_by_proto - Assign VLAN membership based on ethernet frametype and protocol. type: list
      • description - Description. type: str
      • frametypes - Ethernet frame types to check. type: str choices: ethernet2, 802.3d, llc
      • id - Entry ID. type: int
      • protocol - Ethernet protocols (0 - 65535). type: int
    • mld_snooping - Enable/disable MLD snooping for the VLAN interface. type: str choices: enable, disable
    • mld_snooping_fast_leave - Enable/disable MLD snooping fast leave. type: str choices: enable, disable
    • mld_snooping_proxy - Enable/disable MLD snooping proxy for the VLAN interface. type: str choices: enable, disable
    • mld_snooping_querier - Enable/disable MLD snooping querier for the VLAN interface. type: str choices: enable, disable
    • mld_snooping_querier_addr - MLD-querier address. type: str
    • mld_snooping_static_group - MLD static groups. type: list
      • ignore_reports - Enable/disable to ignore all MLD membership reports received for this group. type: str choices: enable, disable
      • mcast_addr - IPv6 Multicast address for static-group. type: str
      • members - Member interfaces. type: list
        • member_name - Interface name. type: str
      • name - Group name. type: str
    • mrouter_ports - Member interfaces. type: list
      • member_name - Interface name. type: str
    • policer - Set policer on the VLAN traffic. type: int
    • primary_vlan - Primary VLAN ID. type: int
    • private_vlan - Enable/disable private VLAN. type: str choices: enable, disable
    • private_vlan_type - Private VLAN type. type: int
    • rspan_mode - Stop L2 learning and interception of BPDUs and other packets on this VLAN. type: str choices: enable, disable

Examples

- name: Configure optional per-VLAN settings.
  fortinet.fortiswitch.fortiswitch_switch_vlan:
      state: "present"
      switch_vlan:
          access_vlan: "disable"
          arp_inspection: "disable"
          assignment_priority: "5"
          community_vlans: "<your_own_value>"
          cos_queue: "7"
          description: "<your_own_value>"
          dhcp6_snooping: "disable"
          dhcp_server_access_list:
              -
                  name: "default_name_11"
                  server_ip: "<your_own_value>"
                  server_ip6: "<your_own_value>"
          dhcp_snooping: "disable"
          dhcp_snooping_option82: "disable"
          dhcp_snooping_static_client:
              -
                  ip_addr: "<your_own_value>"
                  mac_addr: "<your_own_value>"
                  name: "default_name_19"
                  switch_interface: "<your_own_value>"
          dhcp_snooping_verify_mac: "disable"
          id: "22"
          igmp_snooping: "enable"
          igmp_snooping_fast_leave: "enable"
          igmp_snooping_proxy: "enable"
          igmp_snooping_querier: "enable"
          igmp_snooping_querier_addr: "<your_own_value>"
          igmp_snooping_querier_version: "28"
          igmp_snooping_static_group:
              -
                  ignore_reports: "enable"
                  mcast_addr: "<your_own_value>"
                  members:
                      -
                          member_name: "<your_own_value> (source switch.interface.name)"
                  name: "default_name_34"
          isolated_vlan: "35"
          lan_segment: "enable"
          lan_segment_primary_vlan: "37"
          lan_segment_type: "38"
          lan_subvlans: "<your_own_value>"
          learning: "disable"
          learning_limit: "41"
          member_by_ipv4:
              -
                  address: "<your_own_value>"
                  description: "<your_own_value>"
                  id: "45"
          member_by_ipv6:
              -
                  description: "<your_own_value>"
                  id: "48"
                  prefix: "<your_own_value>"
          member_by_mac:
              -
                  description: "<your_own_value>"
                  id: "52"
                  mac: "<your_own_value>"
          member_by_proto:
              -
                  description: "<your_own_value>"
                  frametypes: "ethernet2"
                  id: "57"
                  protocol: "58"
          mld_snooping: "enable"
          mld_snooping_fast_leave: "enable"
          mld_snooping_proxy: "enable"
          mld_snooping_querier: "enable"
          mld_snooping_querier_addr: "<your_own_value>"
          mld_snooping_static_group:
              -
                  ignore_reports: "enable"
                  mcast_addr: "<your_own_value>"
                  members:
                      -
                          member_name: "<your_own_value> (source switch.interface.name)"
                  name: "default_name_69"
          mrouter_ports:
              -
                  member_name: "<your_own_value>"
          policer: "72 (source switch.acl.policer.id)"
          primary_vlan: "73"
          private_vlan: "enable"
          private_vlan_type: "75"
          rspan_mode: "enable"

Return Values

Common return values are documented: https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values, the following are the fields unique to this module:

  • build - Build number of the fortiSwitch image returned: always type: str sample: 1547
  • http_method - Last method used to provision the content into FortiSwitch returned: always type: str sample: PUT
  • http_status - Last result given by FortiSwitch on last operation applied returned: always type: str sample: 200
  • mkey - Master key (id) used in the last call to FortiSwitch returned: success type: str sample: id
  • name - Name of the table used to fulfill the request returned: always type: str sample: urlfilter
  • path - Path of the table used to fulfill the request returned: always type: str sample: webfilter
  • serial - Serial number of the unit returned: always type: str sample: FS1D243Z13000122
  • status - Indication of the operation's result returned: always type: str sample: success
  • version - Version of the FortiSwitch returned: always type: str sample: v7.0.0

Status

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

Authors

  • Link Zheng (@chillancezen)

  • Jie Xue (@JieX19)

  • Hongbin Lu (@fgtdev-hblu)

  • Frank Shen (@frankshen01)

  • Miguel Angel Munoz (@mamunozgonzalez)

Hint

If you notice any issues in this documentation, you can create a pull request to improve it.