Vm mount iso and install vmware tools

IS there a playbook or how do i start with installing and upgrading vmware tools on windows vm

for VM with no tools installed

I need to

  1. mount the vmware tools iso
  2. run the setup64.exe /S /v “/qn REBOOT=R ADDLOCAL=ALL”

any idea how to start with this?

https://docs.ansible.com/ansible/latest/modules/vmware_guest_tools_upgrade_module.html#vmware-guest-tools-upgrade-module

Hi,

Why not using curl on this site or into an internal server synchronized on this server :

https://packages.vmware.com/tools/esx/index.html

For example you have direct executable here :

https://packages.vmware.com/tools/esx/6.7u3/windows/x64/

Use win_get_url module and win_command_module should help…

Using this technique it’s up to you to install whatever vmware toolbox you want…respecting the matrix on the vmware website on host and guest

(Sometime you can install a vmware tools not available on iso using this tip but compatible with your guest/host combination)

Regards,

JYL

I am not sure. because curl is not available on windows boxes.

As written in my email : win_get_url module

Télécharger BlueMail pour Android

any idea why this is failing? Syntax is right as far as I can tell

TASK [Create Directory if not exist] ****************************************************************************************************
ok: [rw-ctxweb-02.wsgr.com]
ok: [pa-mgt01.wsgr.com]

TASK [Download exe to winbox] ***********************************************************************************************************
fatal: [rw-ctxweb-02.xxxx]: FAILED! => {“changed”: false, “msg”: “Unsupported parameters for (win_get_url) module: destination. Supported parameters include: url_username, proxy_username, client_cert_password, timeout, checksum_url, checksum_algorithm, method, force_basic_auth, checksum, http_agent, validate_certs, use_proxy, dest, proxy_password, headers, proxy_url, proxy_use_default_credential, url_password, url, follow_redirects, use_default_credential, client_cert, force, maximum_redirection, user, username, password”}
fatal: [pa-mgt01.xxxxxx]: FAILED! => {“changed”: false, “msg”: “Unsupported parameters for (win_get_url) module: destination. Supported parameters include: url_username, proxy_username, client_cert_password, timeout, checksum_url, checksum_algorithm, method, force_basic_auth, checksum, http_agent, validate_certs, use_proxy, dest, proxy_password, headers, proxy_url, proxy_use_default_credential, url_password, url, follow_redirects, use_default_credential, client_cert, force, maximum_redirection, user, username, password”}

PLAY RECAP ******************************************************************************************************************************
pa-mgt01.xxxxx : ok=2 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
rw-ctxweb-02.xxxxx : ok=2 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

tony@ubuntu2:~/windows$ cat download.yml

any idea why this is failing? Syntax is right as far as I can tell

That tells me that your prowess in reading error messages is somewhat limited :-).

As per documentation: use dest parameter instead of destination.

Regards
       Racke

Thank you.

any idea what this error is?

TASK [Install Vmware tools Silent] ************************************************************************************************************
task path: /home/tony/windows/download.yml:15
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/win_package.ps1
Pipelining is enabled.
<pa-mgt01.wsgr.com> ESTABLISH WINRM CONNECTION FOR USER: adm-tkw@WSGR.COM on PORT 5986 TO pa-mgt01.wsgr.com
EXEC (via pipeline wrapper)
fatal: [pa-mgt01.wsgr.com]: FAILED! => {
“changed”: false,
“msg”: “unexpected rc from install c:\temp\VMware-tools-11.0.5-15389592-x86_64.exe: see rc, stdout and stderr for more details”,
“rc”: 1639,
“reboot_required”: false,
“stderr”: “”,
“stderr_lines”: ,
“stdout”: “”,
“stdout_lines”:
}

PLAY RECAP ************************************************************************************************************************************
pa-mgt01 : ok=3 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

playbook:

tony@ubuntu2:~/windows$ cat download.yml

any idea? I added state: present and still getting same error

fatal: [pa-mgt01.wsgr.com]: FAILED! => {
“changed”: false,
“msg”: “unexpected rc from install c:\temp\VMware-tools-11.0.5-15389592-x86_64.exe: see rc, stdout and stderr for more details”,
“rc”: 1639,
“reboot_required”: false,
“stderr”: “”,
“stderr_lines”: ,
“stdout”: “”,
“stdout_lines”:

instead of the win_get_url use the win_package that will install the application for you vm_tools

win_package:
path: https://repo.saltstack.com/windows/Salt-Minion-3000-Py3-AMD64-Setup.exe
product_id: ‘Salt-Minion-3000-Py3-AMD64-Setup.exe’
arguments: ‘Salt-Minion-3000-Py3-AMD64-Setup.exe /S /master={{ master }} /minion-name={{ minion }}’
state: present

but I got all the steps working except win_package,

There seems to be something wrong with execution.

I manually ran the setup.exe and works

Hi,

Just a guess (I’m not a windows man)…Perhaps you need to do silent install because you are not “desktop logged” when you use ansible.

Have a look here for some example (you need to look for the good ones for your version, but you’ve got the idea)

https://uncomplicatingit.com/vmware/command-to-do-a-complete-vmware-tools-install-silently/

Regards,

JYL

I already tried the arguments. I know /s /v /qn works manually.

why does that work on ansible?

now no errors but its not getting installed as it would manually,

PLAY [testing win_get_url] ******************************************************************************************************************************

TASK [Gathering Facts] **********************************************************************************************************************************
task path: /home/tony/windows/download.yml:2
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/setup.ps1
Pipelining is enabled.
ESTABLISH WINRM CONNECTION FOR USER: adm-tkw@WSGR.COM on PORT 5986 TO w10-adm-tkw
EXEC (via pipeline wrapper)
ok: [w10-adm-tkw]
META: ran handlers

TASK [Create Directory if not exist] ********************************************************************************************************************
task path: /home/tony/windows/download.yml:5
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/win_file.ps1
Pipelining is enabled.
ESTABLISH WINRM CONNECTION FOR USER: adm-tkw@WSGR.COM on PORT 5986 TO w10-adm-tkw
EXEC (via pipeline wrapper)
ok: [w10-adm-tkw] => {
“changed”: false
}

TASK [Download exe to winbox] ***************************************************************************************************************************
task path: /home/tony/windows/download.yml:10
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/win_get_url.ps1
Pipelining is enabled.
ESTABLISH WINRM CONNECTION FOR USER: adm-tkw@WSGR.COM on PORT 5986 TO w10-adm-tkw
EXEC (via pipeline wrapper)
ok: [w10-adm-tkw] => {
“changed”: false,
“checksum_dest”: “a6a1ffd84082aa327c40c17171c98027124418f7”,
“checksum_src”: “a6a1ffd84082aa327c40c17171c98027124418f7”,
“dest”: “c:\temp\VMware-tools-11.0.5-15389592-x86_64.exe”,
“elapsed”: 2.0483192999999997,
“invocation”: {
“module_args”: {
“checksum”: null,
“checksum_algorithm”: “sha1”,
“checksum_url”: null,
“client_cert”: null,
“client_cert_password”: null,
“dest”: “c:\temp\VMware-tools-11.0.5-15389592-x86_64.exe”,
“follow_redirects”: “safe”,
“force”: true,
“force_basic_auth”: false,
“headers”: null,
“http_agent”: “ansible-httpget”,
“maximum_redirection”: 50,
“method”: null,
“proxy_password”: null,
“proxy_url”: null,
“proxy_use_default_credential”: false,
“proxy_username”: null,
“timeout”: 30,
“url”: “https://packages.vmware.com/tools/esx/latest/windows/x64/VMware-tools-11.0.5-15389592-x86_64.exe”,
“url_password”: null,
“url_username”: null,
“use_default_credential”: false,
“use_proxy”: true,
“validate_certs”: true
}
},
“msg”: “OK”,
“size”: 96612272,
“status_code”: 200,
“url”: “https://packages.vmware.com/tools/esx/latest/windows/x64/VMware-tools-11.0.5-15389592-x86_64.exe
}

TASK [Install Vmware tools Silent] **********************************************************************************************************************
task path: /home/tony/windows/download.yml:15
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/win_package.ps1
Pipelining is enabled.
ESTABLISH WINRM CONNECTION FOR USER: adm-tkw@xxxxxx on PORT 5986 TO w10-adm-tkw
EXEC (via pipeline wrapper)
ok: [w10-adm-tkw] => {
“changed”: false,
“reboot_required”: false
}
META: ran handlers
META: ran handlers

PLAY RECAP **********************************************************************************************************************************************
w10-adm-tkw : ok=4 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

why is ansible seeing the destination as :

“dest”: “c:\temp\VMware-tools-11.0.5-15389592-x86_64.exe”,

it should be "c:\temp\VMware-tools-11.0.5-15389592-x86_64.exe

ok I got it working now with win_command but still having some errors

TASK [Install Vmware tools Silent] **********************************************************************************************************************
task path: /home/tony/windows/download2.yml:15
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/win_command.ps1
Pipelining is enabled.
ESTABLISH WINRM CONNECTION FOR USER: adm-tkw@WSGR.COM on PORT 5986 TO w10-adm-tkw
EXEC (via pipeline wrapper)
fatal: [w10-adm-tkw]: FAILED! => {
“changed”: true,
“cmd”: “c:\temp\VMware-tools-11.0.5-15389592-x86_64.exe /S /v "/qn REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs"”,
“delta”: “0:01:07.028344”,
“end”: “2020-05-26 10:31:06.576186”,
“msg”: “non-zero return code”,
“rc”: 3010,
“start”: “2020-05-26 10:29:59.547842”,
“stderr”: “”,
“stderr_lines”: ,
“stdout”: “”,
“stdout_lines”:
}

PLAY RECAP **********************************************************************************************************************************************
w10-adm-tkw : ok=3 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

what is wrong?