W3cubDocs

/Ansible

win_package - Installs/Uninstalls an installable package, either from local file system or url

New in version 1.7.

Synopsis

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 HKLM:Software\Microsoft\Windows\CurrentVersion\Uninstall or for 32 bit programs HKLM:Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall

Options

parameter required default choices comments
arguments
no
Any arguments the installer needs
name
no
Name of the package, if name isn't specified the path will be used for log messages
path
yes
Location of the package to be installed (either on file system, network share or url)
product_id
yes
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 HKLM:Software\Microsoft\Windows\CurrentVersion\Uninstall or for 32 bit programs HKLM:Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
aliases: productid
state
no present
  • present
  • absent
Install or Uninstall
aliases: ensure
user_name
no
Username of an account with access to the package if its 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.
user_password
no
Password of an account with access to the package if its 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.

Examples

# Playbook example
- name: Install the vc 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"

# Install/uninstall an msi-based package
- name: Install msi-based package (Remote Desktop Connection Manager)
  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 msi-based package
  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

This is an Extras Module

For more information on what this means please read Extras Modules

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/win_package_module.html