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 4.8.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_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 |
|
The direction of the connection. Required when Choices:
|
|
When you use serial port pipe backing to connect a virtual machine to another process, you must define the endpoints. Required when Choices:
|
|
File path for the host file used in this backing. Fully qualified path is required, like <datastore_name>/<file_name>. Required when |
|
Enables optimized data transfer over the pipe. Required when Choices:
|
|
Pipe name for the host pipe. Required when |
|
Identifies a vSPC proxy service that provides network access to the If you specify a proxy URI, the virtual machine initiates a connection with the proxy service and forwards the serviceURI and direction to the proxy. The |
|
Identifies the local host or a system on the network, depending on the value of 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 |
|
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 |
|
The password of the vSphere vCenter or ESXi server. If the value is not specified in the task, the value of environment variable |
|
The port number of the vSphere vCenter or ESXi server. If the value is not specified in the task, the value of environment variable 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 |
|
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 |
|
Allows connection when SSL certificates are not valid. Set to If the value is not specified in the task, the value of environment variable Choices:
|
Notes
Note
All modules requires API write access and hence is not supported on a free ESXi license.
All variables and VMware object names are case sensitive.
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
# Create vSPC port
- name: Create network serial port with vSPC
community.vmware.vmware_guest_serial_port:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
name: "test_vm1"
backings:
- type: 'network'
direction: 'server'
service_uri: 'vSPC.py'
proxy_uri: 'telnets://<host>:<port>'
yield_on_poll: true
# 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: |