Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ansible.windows.win_package continues to download .exe files originating from URL or UNC regardless of product_id #479

Closed
jmdudley opened this issue Mar 15, 2023 · 0 comments · Fixed by #480

Comments

@jmdudley
Copy link

SUMMARY

The win_package module does not honor the product_id parameter for .exe files whose path type is URL or UNC until after the file has been downloaded. This results in the file being re-downloaded on every run regardless of the existence of the product_id in the registry.

I believe the issue is that the $Id variable used in this statement is never defined and should instead be replaced with either $getParams.Id or $productId

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_package

ANSIBLE VERSION
  ansible [core 2.13.8]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/username/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/username/.local/lib/python3.8/site-packages/ansible
  ansible collection location = /home/username/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/username/.local/bin/ansible
  python version = 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
Collection      Version
--------------- -------
ansible.windows 1.13.0
CONFIGURATION
default
OS / ENVIRONMENT

target OS: various versions of Windows

STEPS TO REPRODUCE

Run a task using the win_package module to install an .exe file from URL or UNC path while providing the appropriate product_id parameter.

- name: Install Visual C thingy
  ansible.windows.win_package:
    path: http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe
    product_id: '{ca67548a-5ebe-413a-b50c-4b9ceb6d66c6}'
    arguments:
    - /install
    - /passive
    - /norestart
EXPECTED RESULTS

After initial install, the vcredist_x64.exe file should no longer be downloaded since the specified product_id exists in the registry at HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall{ca67548a-5ebe-413a-b50c-4b9ceb6d66c6}

ACTUAL RESULTS

The vcredist_x64.exe file continues to be downloaded on every run of the task, which can be observed on the remote host. However, the file is not re-installed and the task results in changed=false since the product_id is honored after the download step.

Initial Run:

TASK [starter-role : Install Visual C thingy
path=http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe, product_id={ca67548a-5ebe-413a-b50c-4b9ceb6d66c6}, arguments=['/install', '/passive', '/norestart']] ***
task path: /tasks/install_dependencies.yml:24
Wednesday 15 March 2023  09:03:53 -0400 (0:00:00.070)       0:00:14.163 *******
Using module file /.cache/ansible-compat/b11e21/collections/ansible_collections/ansible/windows/plugins/modules/win_package.ps1
Pipelining is enabled.
<127.0.0.1> ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 55985 TO 127.0.0.1
EXEC (via pipeline wrapper)
changed: [starter-role-windows] => changed=true 
  elapsed: 6.470174699999999
  invocation:
    module_args:
      arguments:
      - /install
      - /passive
      - /norestart
      chdir: null
      client_cert: null
      client_cert_password: null
      creates_path: null
      creates_service: null
      creates_version: null
      expected_return_code:
      - 0
      - 3010
      follow_redirects: safe
      force_basic_auth: false
      headers: null
      http_agent: ansible-httpget
      log_path: null
      maximum_redirection: 50
      password: null
      path: http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe
      product_id: '{ca67548a-5ebe-413a-b50c-4b9ceb6d66c6}'
      provider: auto
      proxy_password: null
      proxy_url: null
      proxy_use_default_credential: false
      proxy_username: null
      state: present
      url_method: null
      url_password: null
      url_timeout: 30
      url_username: null
      use_default_credential: false
      use_proxy: true
      username: null
      validate_certs: true
      wait_for_children: false
  msg: OK
  rc: 0
  reboot_required: false
  status_code: 20

Subsequent run:

TASK [starter-role : Install Visual C thingy
path=http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe, product_id={ca67548a-5ebe-413a-b50c-4b9ceb6d66c6}, arguments=['/install', '/passive', '/norestart']] ***
task path: /tasks/install_dependencies.yml:24
Wednesday 15 March 2023  09:07:17 -0400 (0:00:00.049)       0:00:10.746 *******
Using module file /.cache/ansible-compat/b11e21/collections/ansible_collections/ansible/windows/plugins/modules/win_package.ps1
Pipelining is enabled.
<127.0.0.1> ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 55985 TO 127.0.0.1
EXEC (via pipeline wrapper)
ok: [starter-role-windows] => changed=false 
  elapsed: 6.4227305999999995
  invocation:
    module_args:
      arguments:
      - /install
      - /passive
      - /norestart
      chdir: null
      client_cert: null
      client_cert_password: null
      creates_path: null
      creates_service: null
      creates_version: null
      expected_return_code:
      - 0
      - 3010
      follow_redirects: safe
      force_basic_auth: false
      headers: null
      http_agent: ansible-httpget
      log_path: null
      maximum_redirection: 50
      password: null
      path: http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe
      product_id: '{ca67548a-5ebe-413a-b50c-4b9ceb6d66c6}'
      provider: auto
      proxy_password: null
      proxy_url: null
      proxy_use_default_credential: false
      proxy_username: null
      state: present
      url_method: null
      url_password: null
      url_timeout: 30
      url_username: null
      use_default_credential: false
      use_proxy: true
      username: null
      validate_certs: true
      wait_for_children: false
  msg: OK
  rc: 0
  reboot_required: false
  status_code: 200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant