community.vmware.vmware_guest_sendkey – Send USB HID codes to the Virtual Machine’s keyboard.¶
Note
This plugin is part of the community.vmware collection (version 1.9.0).
To install it use: ansible-galaxy collection install community.vmware
.
To use it in a playbook, specify: community.vmware.vmware_guest_sendkey
.
Synopsis¶
This module is used to send keystrokes to given virtual machine.
All parameters and VMware object names are case sensitive.
Requirements¶
The below requirements are needed on the host that executes this module.
python >= 2.6
PyVmomi
Parameters¶
Examples¶
- name: Send list of keys to virtual machine
community.vmware.vmware_guest_sendkey:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: "{{ folder_name }}"
name: "{{ vm_name }}"
keys_send:
- TAB
- TAB
- ENTER
delegate_to: localhost
register: keys_num_sent
- name: Send list of keys to virtual machine using MoID
community.vmware.vmware_guest_sendkey:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: "{{ folder_name }}"
moid: vm-42
keys_send:
- CTRL_ALT_DEL
delegate_to: localhost
register: ctrl_alt_del_sent
- name: Send a string to virtual machine
community.vmware.vmware_guest_sendkey:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: "{{ folder_name }}"
name: "{{ vm_name }}"
string_send: "user_logon"
delegate_to: localhost
register: keys_num_sent
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Authors¶
Diane Wang (@Tomorrow9) <dianew@vmware.com>