ansible / ansible.builtin / v2.3.3.0-1 / module / win_package Installs/Uninstalls an installable package, either from local file system or url | "added in version" 1.7 of ansible.builtin" Authors: Trond Hindenes preview | supported by coreansible.builtin.win_package (v2.3.3.0-1) — module
pip
Install with pip install ansible==2.3.3.0.post1
Installs or uninstalls a package.
Optionally uses a product_id to check if the package needs installing. You can find product ids for installed programs in the windows registry either in C(HKLM:Software\Microsoft\Windows\CurrentVersion\Uninstall) or for 32 bit programs C(HKLM:Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall)
- name: Install the Visual C thingy win_package: name: Microsoft Visual C thingy path: http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe product_id: '{CF2BEA3C-26EA-32F8-AA9B-331F7E34BA97}' arguments: /install /passive /norestart
- name: Install Remote Desktop Connection Manager from msi win_package: path: https://download.microsoft.com/download/A/F/0/AF0071F3-B198-4A35-AA90-C68D103BDCCF/rdcman.msi product_id: '{0240359E-6A4C-4884-9E94-B397A02D893C}'
- name: Uninstall Remote Desktop Connection Manager installed from msi win_package: path: https://download.microsoft.com/download/A/F/0/AF0071F3-B198-4A35-AA90-C68D103BDCCF/rdcman.msi product_id: '{0240359E-6A4C-4884-9E94-B397A02D893C}' state: absent
# Specify the expected non-zero return code when successful # In this case 3010 indicates 'reboot required' - name: 'Microsoft .NET Framework 4.5.1' win_package: path: https://download.microsoft.com/download/1/6/7/167F0D79-9317-48AE-AEDB-17120579F8E2/NDP451-KB2858728-x86-x64-AllOS-ENU.exe productid: '{7DEBE4EB-6B40-3766-BB35-5CBBC385DA37}' arguments: '/q /norestart' ensure: present expected_return_code: 3010
# Specify multiple non-zero return codes when successful # In this case we can say that both 0 (SUCCESSFUL) and 3010 (REBOOT REQUIRED) codes are acceptable - name: 'Microsoft .NET Framework 4.5.1' win_package: path: https://download.microsoft.com/download/1/6/7/167F0D79-9317-48AE-AEDB-17120579F8E2/NDP451-KB2858728-x86-x64-AllOS-ENU.exe productid: '{7DEBE4EB-6B40-3766-BB35-5CBBC385DA37}' arguments: '/q /norestart' ensure: present expected_return_code: [0,3010]
name: default: null description: - Name of the package, if name isn't specified the path will be used for log messages required: false path: description: - Location of the package to be installed (either on file system, network share or url) required: true state: aliases: - ensure choices: - present - absent default: present description: - Install or Uninstall required: false arguments: default: null description: - Any arguments the installer needs required: false user_name: default: null description: - Username of an account with access to the package if it's located on a file share. Only needed if the winrm user doesn't have access to the package. Also specify user_password for this to function properly. required: false product_id: aliases: - productid description: - Product id of the installed package (used for checking if already installed) - You can find product ids for installed programs in the windows registry either in C(HKLM:Software\Microsoft\Windows\CurrentVersion\Uninstall) or for 32 bit programs C(HKLM:Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall)' required: true user_password: default: null description: - Password of an account with access to the package if it's located on a file share. Only needed if the winrm user doesn't have access to the package. Also specify user_name for this to function properly. required: false expected_return_code: default: 0 description: - One or more return codes from the package installation that indicates success. - If not provided, defaults to 0 required: false