win_chocolatey - Manage packages using chocolatey
New in version 1.9.
Synopsis
- Manage packages using Chocolatey (http://chocolatey.org/).
- If Chocolatey is missing from the system, the module will install it.
- List of packages can be found at http://chocolatey.org/packages.
Requirements
The below requirements are needed on the host that executes this module.
- chocolatey >= 0.10.5 (will be upgraded if older)
Parameters
Parameter | Choices/Defaults | Comments |
---|---|---|
allow_empty_checksums bool (added in 2.2) |
| Allow empty checksums to be used. |
allow_prerelease bool (added in 2.6) |
| Allow install of prerelease packages. If state state is latest the highest prerelease package will be installed. |
force bool |
| Forces install of the package (even if it already exists). Using force will cause ansible to always report that a change was made. |
ignore_checksums bool (added in 2.2) |
| Ignore checksums altogether. |
ignore_dependencies bool (added in 2.1) |
| Ignore dependencies, only install/upgrade the package itself. |
install_args (added in 2.1) | Arguments to pass to the native installer. | |
name required | Name of the package to be installed. This must be a single package name. | |
params (added in 2.1) | Parameters to pass to the package | |
proxy_password (added in 2.4) | Proxy password used to install chocolatey and the package. See notes in proxy_username when dealing with double quotes in a password. | |
proxy_url (added in 2.4) | Proxy url used to install chocolatey and the package. | |
proxy_username (added in 2.4) | Proxy username used to install chocolatey and the package. When dealing with a username with double quote characters " , they need to be escaped with \ beforehand. See examples for more details. | |
skip_scripts bool (added in 2.4) |
| Do not run chocolateyInstall.ps1 or chocolateyUninstall.ps1 scripts. |
source | Specify source rather than using default chocolatey repository. | |
state |
| State of the package on the system. |
timeout (added in 2.3) | Default: 2700 | The time to allow chocolatey to finish before timing out. aliases: execution_timeout |
version | Specific version of the package to be installed. Ignored when state is set to absent . |
Notes
Note
- Provide the
version
parameter value as a string (e.g.'6.1'
), otherwise it is considered to be a floating-point number and depending on the locale could become6,1
, which will cause a failure. - When using verbosity 2 or less (
-vv
) thestdout
output will be restricted. - When using verbosity 4 (
-vvvv
) thestdout
output will be more verbose. - When using verbosity 5 (
-vvvvv
) thestdout
output will include debug output. - This module will install or upgrade Chocolatey when needed.
- Some packages need an interactive user logon in order to install. You can use (
become
) to achieve this. - Even if you are connecting as local Administrator, using (
become
) to become Administrator will give you an interactive user logon, see examples below. - Use (win_hotfix to install hotfixes instead of (win_chocolatey) as (win_hotfix) avoids using wusa.exe which cannot be run remotely.
Examples
- name: Install git win_chocolatey: name: git state: present - name: Upgrade installed packages win_chocolatey: name: all state: latest - name: Install notepadplusplus version 6.6 win_chocolatey: name: notepadplusplus version: '6.6' - name: Install git from specified repository win_chocolatey: name: git source: https://someserver/api/v2/ - name: Uninstall git win_chocolatey: name: git state: absent - name: Install multiple packages win_chocolatey: name: '{{ item }}' state: present with_items: - procexp - putty - windirstat - name: uninstall multiple packages win_chocolatey: name: '{{ item }}' state: absent with_items: - procexp - putty - windirstat - name: Install curl using proxy win_chocolatey: name: curl proxy_url: http://proxy-server:8080/ proxy_username: joe proxy_password: p@ssw0rd - name: Install curl with proxy credentials that contain quotes win_chocolatey: name: curl proxy_url: http://proxy-server:8080/ proxy_username: user with \"escaped\" double quotes proxy_password: pass with \"escaped\" double quotes - name: Install a package that requires 'become' win_chocolatey: name: officepro2013 become: yes become_user: Administrator become_method: runas
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
command str | changed | The full command used in the chocolatey task. Sample: choco.exe install -r --no-progress -y sysinternals --timeout 2700 --failonunfound |
rc int | changed | The return code from the chocolatey task. |
stdout str | changed | The stdout from the chocolatey task. The verbosity level of the messages are affected by Ansible verbosity setting, see notes for more details. Sample: Chocolatey upgraded 1/1 packages. |
Status
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Maintenance
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Author
- Trond Hindenes (@trondhindenes)
- Peter Mounce (@petemounce)
- Pepe Barbe (@elventear)
- Adam Keech (@smadam813)
- Pierre Templier (@ptemplier)
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.6/modules/win_chocolatey_module.html