community / community.vmware / 1.18.2 / module / vmware_vspan_session Create or remove a Port Mirroring session. Authors: Peter Gyorgy (@gyorgypeter)community.vmware.vmware_vspan_session (1.18.2) — module
Install with ansible-galaxy collection install community.vmware:==1.18.2
collections: - name: community.vmware version: 1.18.2
This module can be used to create, delete or edit different kind of port mirroring sessions.
- name: Create distributed mirroring session. community.vmware.vmware_vspan_session: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' switch_name: dvSwitch state: present name: Basic Session enabled: True description: "Example description" source_port_transmitted: 817 source_port_received: 817 destination_port: 815 delegate_to: localhost
- name: Create remote destination mirroring session. community.vmware.vmware_vspan_session: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' switch_name: dvSwitch state: present name: Remote Session enabled: True description: "Example description" source_port_received: 105 destination_port: 815 session_type: "remoteMirrorDest" delegate_to: localhost
- name: Delete remote destination mirroring session. community.vmware.vmware_vspan_session: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' switch_name: dvSwitch state: absent name: Remote Session delegate_to: localhost
name: description: - Name of the session. required: true type: str port: default: 443 description: - The port number of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable C(VMWARE_PORT) will be used instead. - Environment variable support added in Ansible 2.6. type: int state: choices: - present - absent description: - Create or remove the session. required: true type: str switch: aliases: - switch_name description: - The name of the distributed vSwitch on which to add or remove the mirroring session. required: true type: str enabled: default: true description: - Whether the session is enabled. type: bool hostname: description: - The hostname or IP address of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable C(VMWARE_HOST) will be used instead. - Environment variable support added in Ansible 2.6. type: str password: aliases: - pass - pwd description: - The password of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable C(VMWARE_PASSWORD) will be used instead. - Environment variable support added in Ansible 2.6. type: str username: aliases: - admin - user description: - The username of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable C(VMWARE_USER) will be used instead. - Environment variable support added in Ansible 2.6. type: str proxy_host: description: - Address of a proxy that will receive all HTTPS requests and relay them. - The format is a hostname or a IP. - If the value is not specified in the task, the value of environment variable C(VMWARE_PROXY_HOST) will be used instead. - This feature depends on a version of pyvmomi greater than v6.7.1.2018.12 required: false type: str proxy_port: description: - Port of the HTTP proxy that will receive all HTTPS requests and relay them. - If the value is not specified in the task, the value of environment variable C(VMWARE_PROXY_PORT) will be used instead. required: false type: int description: description: - The description for the session. required: false type: str session_type: choices: - encapsulatedRemoteMirrorSource - remoteMirrorDest - remoteMirrorSource - dvPortMirror default: dvPortMirror description: - Select the mirroring type. - In C(encapsulatedRemoteMirrorSource) session, Distributed Ports can be used as source entities, and IP address can be used as destination entities. - In C(remoteMirrorDest) session, VLAN IDs can be used as source entities, and Distributed Ports can be used as destination entities. - In C(remoteMirrorSource) session, Distributed Ports can be used as source entities, and uplink ports name can be used as destination entities. - In C(dvPortMirror) session, Distributed Ports can be used as both source and destination entities. required: false type: str sampling_rate: description: - Sampling rate of the session. - If its value is n, one of every n packets is mirrored. - Valid values are between 1 to 65535. required: false type: int destination_vm: description: - With this parameter it is possible, to add a NIC of a VM to a port mirroring session. required: false suboptions: name: description: - Name of the VM. type: str nic_label: description: - Label of the network interface card to use. type: str type: dict validate_certs: default: true description: - Allows connection when SSL certificates are not valid. Set to C(false) when certificates are not trusted. - If the value is not specified in the task, the value of environment variable C(VMWARE_VALIDATE_CERTS) will be used instead. - Environment variable support added in Ansible 2.6. - If set to C(true), please make sure Python >= 2.7.9 is installed on the given machine. type: bool destination_port: description: - Destination port that received the mirrored packets. - Also any port designated in the value of this property can not match the source port in any of the Distributed Port Mirroring session. required: false type: str source_vm_received: description: - With this parameter it is possible, to add a NIC of a VM to a port mirroring session. suboptions: name: description: - Name of the VM. type: str nic_label: description: - Label of the network interface card to use. type: str type: dict strip_original_vlan: description: - Whether to strip the original VLAN tag. - If false, the original VLAN tag will be preserved on the mirrored traffic. - If C(encapsulationVlanId) has been set and this property is false, the frames will be double tagged with the original VLAN ID as the inner tag. required: false type: bool source_port_received: description: - Source port for which received packets are mirrored. required: false type: str encapsulation_vlan_id: description: - VLAN ID used to encapsulate the mirrored traffic. required: false type: int source_vm_transmitted: description: - With this parameter it is possible, to add a NIC of a VM to a port mirroring session. suboptions: name: description: - Name of the VM. type: str nic_label: description: - Label of the network interface card to use. type: str type: dict mirrored_packet_length: description: - An integer that describes how much of each frame to mirror. - If unset, all of the frame would be mirrored. - Setting this property to a smaller value is useful when the consumer will look only at the headers. - The value cannot be less than 60. required: false type: int normal_traffic_allowed: description: - Whether or not destination ports can send and receive "normal" traffic. - Setting this to false will make mirror ports be used solely for mirroring and not double as normal access ports. required: false type: bool source_port_transmitted: description: - Source port for which transmitted packets are mirrored. required: false type: str