Hi,
I just started using Ansible and I'm having trouble sending key strokes to a VM to select options for an OS install. However, I get a "Failed to send key ... to virtual machine due to None" when trying to send keys. I have also tried using string_send (just to see if it worked), and I also got the same error.
The information to connect to vSphere is correct, because I was able to run a vmware_guest to create a VM, although I was wondering if it my be a permissions issue as I don't have all privileges on my account.
Thanks for your help!
yaml file
---
- name: test
hosts: ansibleclient01.local
tasks:
- vmware_guest_sendkey:
hostname: "myhostname"
username: "myusername"
password: "mypassword"
cluster: "Cluster1"
validate_certs: no
folder: myfolder
name: ansible_test_vm_0001
keys_send:
- DOWNARROW
- ENTER
delegate_to: localhost
register: keys_num_sent
Output:
TASK [vmware_guest_sendkey] ************************************************************************************************
fatal: [ansibleclient01.local -> localhost]: FAILED! => {"changed": false, "msg": "Failed to send key (vim.vm.UsbScanCodeSpec.KeyEvent) {\n dynamicType = <unset>,\n dynamicProperty = (vmodl.DynamicProperty) [],\n usbHidCode = 1114119,\n modifiers = (vim.vm.UsbScanCodeSpec.ModifierType) {\n dynamicType = <unset>,\n dynamicProperty = (vmodl.DynamicProperty) [],\n leftControl = false,\n leftShift = true,\n leftAlt = false,\n leftGui = false,\n rightControl = false,\n rightShift = false,\n rightAlt = false,\n rightGui = false\n }\n} to virtual machine due to None"}
ansible-playbook --version
ansible-playbook 2.9.7
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/mphadmin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
executable location = /usr/local/bin/ansible-playbook
python version = 3.6.8 (default, Aug 7 2019, 08:02:28) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39.0.1)]
vSphere Version: Version 6.0.0 Build 5112533