Vm mount iso and install vmware tools

207 views
Skip to first unread message

Tony Wong

unread,
May 19, 2020, 9:56:17 AM5/19/20
to Ansible Project
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?

Dick Visser

unread,
May 19, 2020, 10:25:34 AM5/19/20
to ansible...@googlegroups.com
https://docs.ansible.com/ansible/latest/modules/vmware_guest_tools_upgrade_module.html#vmware-guest-tools-upgrade-module
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/fe25871a-3987-4430-93a0-805bc40be8ac%40googlegroups.com.



--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

Jean-Yves LENHOF

unread,
May 19, 2020, 11:16:37 AM5/19/20
to ansible...@googlegroups.com

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

Tony Wong

unread,
May 19, 2020, 11:42:44 AM5/19/20
to ansible...@googlegroups.com
I am not sure.  because curl is not available on windows boxes.

Jean-Yves LENHOF

unread,
May 19, 2020, 11:50:22 AM5/19/20
to ansible...@googlegroups.com
As written in my email : win_get_url module


Télécharger BlueMail pour Android

Tony Wong

unread,
May 26, 2020, 9:10:21 AM5/26/20
to ansible...@googlegroups.com
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
---
- name: testing win_get_url
  hosts: all
  tasks:
    - name: Create Directory if not exist
      win_file:
        path: c:\temp
        state: directory

    - name: Download exe to winbox
      win_get_url:
        url: https://packages.vmware.com/tools/esx/6.7u3/windows/x64/VMware-tools-10.3.10-12406962-x86_64.exe
        destination: c:\temp\VMware-tools-10.3.10-12406962-x86_64.exe


Stefan Hornburg (Racke)

unread,
May 26, 2020, 9:26:26 AM5/26/20
to ansible...@googlegroups.com
On 5/26/20 3:09 PM, Tony Wong wrote:
> 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

>
> TASK [Create Directory if not exist]
> ****************************************************************************************************
> ok: [rw-ctxweb-02.wsgr.com <http://rw-ctxweb-02.wsgr.com>]
> ok: [pa-mgt01.wsgr.com <http://pa-mgt01.wsgr.com>]
> Télécharger BlueMail pour Android <http://www.bluemail.me/r?b=15860>
> Le 19 mai 2020, à 17:42, Tony Wong <tdub...@gmail.com <mailto:tdub...@gmail.com>> a écrit:
>
> I am not sure.  because curl is not available on windows boxes.
>
> On Tue, May 19, 2020 at 8:16 AM Jean-Yves LENHOF <jean...@lenhof.eu.org <mailto:jean...@lenhof.eu.org>> wrote:
>
> 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
>
>
> Le 19/05/2020 à 15:56, Tony Wong a écrit :
>> 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?
>> --
>> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to
>> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
>> <https://groups.google.com/d/msgid/ansible-project/fe25871a-3987-4430-93a0-805bc40be8ac%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/c9857c3e-13b7-5300-1d47-d7b2a5315d99%40lenhof.eu.org
> <https://groups.google.com/d/msgid/ansible-project/c9857c3e-13b7-5300-1d47-d7b2a5315d99%40lenhof.eu.org?utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/04e6e6e5-b650-45bb-878a-7c402b085930%40lenhof.eu.org
> <https://groups.google.com/d/msgid/ansible-project/04e6e6e5-b650-45bb-878a-7c402b085930%40lenhof.eu.org?utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CALmkhkrzK_c5Xb%3DQZgBgefDvSpXAES%2BdaHFJFAdkfFjRGUG1sg%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CALmkhkrzK_c5Xb%3DQZgBgefDvSpXAES%2BdaHFJFAdkfFjRGUG1sg%40mail.gmail.com?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

signature.asc

Tony Wong

unread,
May 26, 2020, 9:53:06 AM5/26/20
to ansible...@googlegroups.com
Thank you.

To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/de7d972e-282b-b02d-eb1e-098ef91f791c%40linuxia.de.

Tony Wong

unread,
May 26, 2020, 10:44:00 AM5/26/20
to ansible...@googlegroups.com
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...@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
---
- name: testing win_get_url
  hosts: all
  tasks:
    - name: Create Directory if not exist
      win_file:
        path: c:\temp
        state: directory

    - name: Download exe to winbox
      win_get_url:
        url: https://packages.vmware.com/tools/esx/latest/windows/x64/VMware-tools-11.0.5-15389592-x86_64.exe
        dest: c:\temp\VMware-tools-11.0.5-15389592-x86_64.exe

    - name: Install Vmware tools Silent
      win_package:
        path: c:\temp\VMware-tools-11.0.5-15389592-x86_64.exe
        product_id: '{742FCBAF-EE5D-48B2-9E95-DA0513B79570}'
        arguments: /S /v “/qn REBOOT=R ADDLOCAL=ALL

Tony Wong

unread,
May 26, 2020, 12:19:46 PM5/26/20
to ansible...@googlegroups.com
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": []

David Foley

unread,
May 26, 2020, 3:18:06 PM5/26/20
to Ansible Project
instead of the win_get_url use the win_package that will install the application for you vm_tools

  win_package:
          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

Tony Wong

unread,
May 26, 2020, 4:47:03 PM5/26/20
to ansible...@googlegroups.com
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

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.

Jean-Yves LENHOF

unread,
May 26, 2020, 5:19:30 PM5/26/20
to ansible...@googlegroups.com

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

Tony Wong

unread,
May 26, 2020, 5:53:15 PM5/26/20
to ansible...@googlegroups.com
I already tried the arguments. I know /s /v /qn works manually. 

why does that work on ansible?

---
- name: testing win_get_url
  hosts: all
  tasks:
    - name: Create Directory if not exist
      win_file:
        path: c:\temp
        state: directory

    - name: Download exe to winbox
      win_get_url:
        url: https://packages.vmware.com/tools/esx/latest/windows/x64/VMware-tools-11.0.5-15389592-x86_64.exe
        dest: c:\temp\VMware-tools-11.0.5-15389592-x86_64.exe

    - name: Install Vmware tools Silent
      win_package:
        path: 'c:\temp\VMware-tools-11.0.5-15389592-x86_64.exe'
        product_id: '{01767101-A688-4A95-9C83-6DED9EB6735D}'
        arguments: '/s /v /qn'
        state: present
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~

Tony Wong

unread,
May 26, 2020, 6:08:25 PM5/26/20
to ansible...@googlegroups.com
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.
<w10-adm-tkw> ESTABLISH WINRM CONNECTION FOR USER: adm...@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.
<w10-adm-tkw> ESTABLISH WINRM CONNECTION FOR USER: adm...@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.
<w10-adm-tkw> ESTABLISH WINRM CONNECTION FOR USER: adm...@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.
<w10-adm-tkw> 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

Tony Wong

unread,
May 26, 2020, 6:34:07 PM5/26/20
to ansible...@googlegroups.com
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.
<w10-adm-tkw> ESTABLISH WINRM CONNECTION FOR USER: adm...@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?



---
- name: testing win_get_url
  hosts: all
  tasks:
    - name: Create Directory if not exist
      win_file:
        path: c:\temp
        state: directory

    - name: Download exe to winbox
      win_get_url:
        url: https://packages.vmware.com/tools/esx/latest/windows/x64/VMware-tools-11.0.5-15389592-x86_64.exe
        dest: c:\temp\VMware-tools-11.0.5-15389592-x86_64.exe

    - name: Install Vmware tools Silent
      win_command: c:\temp\VMware-tools-11.0.5-15389592-x86_64.exe /S /v "/qn REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs"
Reply all
Reply to author
Forward
0 new messages