This might help....
Here is the pertinent portions of my playbook using the command module...
-------------------------------------------------------------------------------------
- name: Add hostvar to running playbook
add_host:
hostname: "{{ vmname }}"
ansible_connection: vmware_tools
ansible_vmware_host: <vcenter_server>
ansible_vmware_user: "{{ vm_username }}"
ansible_vmware_password: "{{ vm_password }}"
ansible_vmware_validate_certs: no
ansible_vmware_guest_path: "{{ vm_folder_location.folders[0] | string }}/{{ vmname }}"
ansible_vmware_tools_user: "{{ generic_username }}"
ansible_vmware_tools_password: "{{ generic_password }}"
ansible_user: "{{ generic_username }}"
ansible_command_timeout: 900
# - name: Patch Server <<<<<<< Times out
# yum:
# name: "*"
# state: "latest"
# register: yum_output
# delegate_to: "{{ vmname }}"
- name: Run yum update command <<<<<<<< Times out
command: "yum update -y"
register: yum_output
delegate_to: "{{ vmname }}"
-------------------------------------------------------------------------------------
Here is the trace routout....
The full traceback is:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 147, in run
res = self._execute()
File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 673, in _execute
self._handler.cleanup()
File "/usr/lib/python2.7/site-packages/ansible/plugins/action/__init__.py", line 128, in cleanup
self._remove_tmp_path(self._connection._shell.tmpdir)
File "/usr/lib/python2.7/site-packages/ansible/plugins/action/__init__.py", line 417, in _remove_tmp_path
tmp_rm_res = self._low_level_execute_command(cmd, sudoable=False)
File "/usr/lib/python2.7/site-packages/ansible/plugins/action/__init__.py", line 1085, in _low_level_execute_command
rc, stdout, stderr = self._connection.exec_command(cmd, in_data=in_data, sudoable=sudoable)
File "/usr/lib/python2.7/site-packages/ansible/plugins/connection/vmware_tools.py", line 440, in exec_command
stdout = self.create_temporary_file_in_guest(suffix=".stdout")
File "/usr/lib/python2.7/site-packages/ansible/plugins/connection/vmware_tools.py", line 365, in create_temporary_file_in_guest
return self.fileManager.CreateTemporaryFileInGuest(vm=self.vm, auth=self.vm_auth, prefix=prefix, suffix=suffix)
File "/var/lib/awx/venv/ansible/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 706, in <lambda>
self.f(*(self.args + (obj,) + args), **kwargs)
File "/var/lib/awx/venv/ansible/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 512, in _InvokeMethod
return self._stub.InvokeMethod(self, info, args)
File "/var/lib/awx/venv/ansible/lib/python2.7/site-packages/pyVmomi/SoapAdapter.py", line 1397, in InvokeMethod
raise obj # pylint: disable-msg=E0702
vim.fault.GuestOperationsUnavailable: (vim.fault.GuestOperationsUnavailable) {
dynamicType = <unset>,
dynamicProperty = (vmodl.DynamicProperty) [],
msg = 'The guest operations agent could not be contacted.',
faultCause = <unset>,
faultMessage = (vmodl.LocalizableMessage) []
}
fatal: [vllxansprd]: FAILED! => {
"msg": "Unexpected failure during module execution.",
"stdout": ""
}
-------------------------------------------------------------------------------------
Long running commands fail like "yum update -y" or using the yum module with the update all. If I run an "ls" command or
something that returns quickly, the command returns without issue.
Ideas?
Thanks,
Glen