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.11

FortiSW Version Compatibility


v7.0.0 v7.0.1 v7.0.2 v7.0.3
fortiswitch_switch_vlan yes yes yes yes

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
    • 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
    • dhcp_server_access_list - Configure dhcp server access list. type: list member_path: dhcp_server_access_list:name
      • name - User given name for dhcp-server. type: str required: true
      • 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_verify_mac - Enable/Disable verify source mac. type: str choices: disable, enable
    • dhcp6_snooping - Enable/Disable DHCPv6 snooping on this vlan. 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 member_path: igmp_snooping_static_group:name
      • mcast_addr - Multicast address for static-group. type: str
      • members - Member interfaces. type: list
        • member_name - Interface name. Source switch.interface.name. type: str
      • name - Group name. type: str required: true
    • 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 member_path: member_by_ipv4:id
      • address - Address(/32) or subnet. type: str
      • description - Description. type: str
      • id - Entry ID. type: int required: true
    • member_by_ipv6 - Assign VLAN membership based on IPv6 prefix. type: list member_path: member_by_ipv6:id
      • description - Description. type: str
      • id - Entry ID. type: int required: true
      • prefix - IPv6 prefix (max = /64). type: str
    • member_by_mac - Assign VLAN membership based on MAC address. type: list member_path: member_by_mac:id
      • description - Description. type: str
      • id - Entry ID. type: int required: true
      • mac - MAC address. type: str
    • member_by_proto - Assign VLAN membership based on ethernet frametype and protocol. type: list member_path: member_by_proto:id
      • description - Description. type: str
      • frametypes - Ethernet frame types to check. type: str choices: ethernet2, 802.3d, llc
      • id - Entry ID. type: int required: true
      • 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 member_path: mld_snooping_static_group:name
      • mcast_addr - IPv6 Multicast address for static-group. type: str
      • members - Member interfaces. type: list
        • member_name - Interface name. Source switch.interface.name. type: str
      • name - Group name. type: str required: true
    • mrouter_ports - Member interfaces. type: list
      • member_name - Interface name. type: str
    • policer - Set policer on the VLAN traffic. Source switch.acl.policer.id. 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

- hosts: fortiswitch01
  collections:
    - fortinet.fortiswitch
  connection: httpapi
  vars:
   ansible_httpapi_use_ssl: yes
   ansible_httpapi_validate_certs: no
   ansible_httpapi_port: 443
  tasks:
  - name: Configure optional per-VLAN settings.
    fortiswitch_switch_vlan:
      state: "present"
      switch_vlan:
        access_vlan: "disable"
        arp_inspection: "disable"
        community_vlans: "<your_own_value>"
        cos_queue: "6"
        description: "<your_own_value>"
        dhcp_server_access_list:
         -
            name: "default_name_9"
            server_ip: "<your_own_value>"
            server_ip6: "<your_own_value>"
        dhcp_snooping: "disable"
        dhcp_snooping_option82: "disable"
        dhcp_snooping_verify_mac: "disable"
        dhcp6_snooping: "disable"
        id:  "16"
        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: "22"
        igmp_snooping_static_group:
         -
            mcast_addr: "<your_own_value>"
            members:
             -
                member_name: "<your_own_value> (source switch.interface.name)"
            name: "default_name_27"
        isolated_vlan: "28"
        lan_segment: "enable"
        lan_segment_primary_vlan: "30"
        lan_segment_type: "31"
        lan_subvlans: "<your_own_value>"
        learning: "disable"
        learning_limit: "34"
        member_by_ipv4:
         -
            address: "<your_own_value>"
            description: "<your_own_value>"
            id:  "38"
        member_by_ipv6:
         -
            description: "<your_own_value>"
            id:  "41"
            prefix: "<your_own_value>"
        member_by_mac:
         -
            description: "<your_own_value>"
            id:  "45"
            mac: "<your_own_value>"
        member_by_proto:
         -
            description: "<your_own_value>"
            frametypes: "ethernet2"
            id:  "50"
            protocol: "51"
        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:
         -
            mcast_addr: "<your_own_value>"
            members:
             -
                member_name: "<your_own_value> (source switch.interface.name)"
            name: "default_name_61"
        mrouter_ports:
         -
            member_name: "<your_own_value>"
        policer: "64 (source switch.acl.policer.id)"
        primary_vlan: "65"
        private_vlan: "enable"
        private_vlan_type: "67"
        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.