community.vmware.vmware_guest_serial_port module – Manage serial ports on an existing VM
Note
This module is part of the community.vmware collection (version 2.10.2).
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_guest_serial_port
.
Synopsis
This module can be used to manage serial ports on an existing VM
Parameters
Parameter |
Comments |
---|---|
A list of backings for serial ports.
|
|
Backing type is required for the serial ports to be added or reconfigured or removed. |
|
Serial device absolutely path. Required when backing_type=device. |
|
The direction of the connection. Required when backing_type=network. Choices:
|
|
When you use serial port pipe backing to connect a virtual machine to another process, you must define the endpoints. Required when backing_type=pipe. Choices:
|
|
File path for the host file used in this backing. Fully qualified path is required, like <datastore_name>/<file_name>. Required when backing_type=file. |
|
Enables optimized data transfer over the pipe. Required when backing_type=pipe. Choices:
|
|
Pipe name for the host pipe. Required when backing_type=pipe. |
|
Identifies the local host or a system on the network, depending on the value of direction. If you use the virtual machine as a server, the URI identifies the host on which the virtual machine runs. In this case, the host name part of the URI should be empty, or it should specify the address of the local host. If you use the virtual machine as a client, the URI identifies the remote system on the network. Required when backing_type=network. |
|
If If If an existing serial port to modify or remove, Choices:
|
|
Enables CPU yield behavior. Choices:
|
|
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. |
|
Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance. This is required if |
|
Name of the virtual machine. This is a required parameter, if parameter |
|
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 |
|
Whether to use the VMware instance UUID rather than the BIOS UUID. Choices:
|
|
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. |
|
UUID of the instance to manage the serial ports, this is VMware’s unique identifier. This is a required parameter, if parameter |
|
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
# Create serial ports
- name: Create multiple serial ports with Backing type - network, pipe, device and file
community.vmware.vmware_guest_serial_port:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
name: "test_vm1"
backings:
- type: 'network'
direction: 'client'
service_uri: 'tcp://6000'
yield_on_poll: True
- type: 'pipe'
pipe_name: 'serial_pipe'
endpoint: 'client'
- type: 'device'
device_name: '/dev/char/serial/uart0'
- type: 'file'
file_path: '[datastore1]/file1'
yield_on_poll: True
register: create_multiple_ports
# Modify existing serial port
- name: Modify Network backing type
community.vmware.vmware_guest_serial_port:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
name: '{{ name }}'
backings:
- type: 'network'
state: 'present'
direction: 'server'
service_uri: 'tcp://6000'
delegate_to: localhost
# Remove serial port
- name: Remove pipe backing type
community.vmware.vmware_guest_serial_port:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
name: '{{ name }}'
backings:
- type: 'pipe'
state: 'absent'
delegate_to: localhost
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
metadata about the virtual machine’s serial ports after managing them Returned: always Sample: |