I’m attempting to use win_package to install some software on windows managed hosts and I can’t get it to work if I specify the .exe from a network share. My ansible version is 2.18.9. The documentation is confusing because it mentions parameters which apparently aren’t supported anymore - like username or user_name. The only examples they have for a network share install are those. For example, I try something like this:
- name: Install using win_package
ansible.windows.win_package:
path: \\tsi-nas\Approved_Software\Everyone\Notepad++\64bit\npp.8.6.4.Installer.x64.exe
product_id: notepad++
arguments: /S
state: present
user_name: TRIDSYS\greg
become: true
become_method: runas
become_user: greg
As you can see because of user_name, I am on a domain network. I have set up my connection with kerberos and can successfully connect and ping with win_ping. I was hoping to have an option like user_name to be able to specify the user for the second hop authentication. The response I get is as follows:
fatal: [DEVOPS-GH-VM.tridsys.com]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"arguments": "/S",
"path": "\\\\tsi-nas\\Approved_Software\\Everyone\\Notepad++\\64bit\\npp.8.6.4.Installer.x64.exe",
"product_id": "notepad++",
"state": "present",
"user_name": "TRIDSYS\\greg"
}
},
"msg": "Unsupported parameters for (ansible.windows.win_package) module: user_name. Supported parameters include: validate_certs, use_proxy, proxy_password, arguments, checksum, force_basic_auth, http_agent, headers, expected_return_code, creates_path, proxy_use_default_credential, wait_for_children, proxy_url, log_path, url_timeout, url_username, maximum_redirection, use_default_credential, client_cert, state, proxy_username, follow_redirects, creates_service, url_password, url_method, product_id, checksum_algorithm, creates_version, chdir, client_cert_password, path, provider"
}
Most of those supported parameters mentioned aren’t shown in the documentation for win_package. I’ve searched around for more recent documentation and/or examples of someone recent that has gotten this to work and I am coming up empty handed.
I’ve also tried to use win_copy to get the installer from the network share over to a local drive where I could use win_package but I run into the same problem with win_copy. Again the documentation doesn’t show how to deal with the 2nd hop authentication.
However, I can successfully get this to work if I use win_powershell instead, but that doesn’t give me the flexibility to make sure a specific version of the software is installed. The following DOES work for me:
- name: Install notepad++
ansible.windows.win_powershell:
script: |
\\tsi-nas\Approved_Software\Everyone\Notepad++\64bit\npp.8.6.4.Installer.x64.exe /S
become: true
become_method: runas
become_user: greg
Can someone tell me if there is a proven way to get this to work with more recent versions of ansible?
Thanks.