community.vmware.vmware_vspan_session module – Create or remove a Port Mirroring session.
Note
This module is part of the community.vmware collection (version 3.7.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.vmware
.
To use it in a playbook, specify: community.vmware.vmware_vspan_session
.
Synopsis
This module can be used to create, delete or edit different kind of port mirroring sessions.
Parameters
Parameter |
Comments |
---|---|
The description for the session. |
|
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. |
|
With this parameter it is possible, to add a NIC of a VM to a port mirroring session. |
|
Name of the VM. |
|
Label of the network interface card to use. |
|
Whether the session is enabled. Choices:
|
|
VLAN ID used to encapsulate the mirrored traffic. |
|
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 Environment variable support added in Ansible 2.6. |
|
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. |
|
Name of the session. |
|
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. Choices:
|
|
The password of the vSphere vCenter or ESXi server. If the value is not specified in the task, the value of environment variable Environment variable support added in Ansible 2.6. |
|
The port number of the vSphere vCenter or ESXi server. If the value is not specified in the task, the value of environment variable Environment variable support added in Ansible 2.6. Default: |
|
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 This feature depends on a version of pyvmomi greater than v6.7.1.2018.12 |
|
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 |
|
Sampling rate of the session. If its value is n, one of every n packets is mirrored. Valid values are between 1 to 65535. |
|
Select the mirroring type. In In In In Choices:
|
|
Source port for which received packets are mirrored. |
|
Source port for which transmitted packets are mirrored. |
|
With this parameter it is possible, to add a NIC of a VM to a port mirroring session. |
|
Name of the VM. |
|
Label of the network interface card to use. |
|
With this parameter it is possible, to add a NIC of a VM to a port mirroring session. |
|
Name of the VM. |
|
Label of the network interface card to use. |
|
Create or remove the session. Choices:
|
|
Whether to strip the original VLAN tag. If false, the original VLAN tag will be preserved on the mirrored traffic. If Choices:
|
|
The name of the distributed vSwitch on which to add or remove the mirroring session. |
|
The username of the vSphere vCenter or ESXi server. If the value is not specified in the task, the value of environment variable Environment variable support added in Ansible 2.6. |
|
Allows connection when SSL certificates are not valid. Set to If the value is not specified in the task, the value of environment variable Environment variable support added in Ansible 2.6. If set to Choices:
|
Notes
Note
All modules requires API write access and hence is not supported on a free ESXi license.
Examples
- 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