New in version 1.9.
The below requirements are needed on the host that executes this module.
Parameter |
Choices/Defaults |
Comments |
---|---|---|
allow_empty_checksums
(added in 2.2) |
|
Allow empty checksums to be used.
|
force
|
|
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
(added in 2.2) |
|
Ignore checksums altogether.
|
ignore_dependencies
(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
(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 |
upgrade
|
|
If package is already installed it, try to upgrade to the latest version or to the specified version.
As of Ansible v2.3 this is deprecated, set parameter
state to latest for the same result. |
version
|
|
Specific version of the package to be installed.
Ignored when
state is set to absent . |
Note
- 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:
- pscx
- windirstat
- name: uninstall multiple packages
win_chocolatey:
name: '{{ item }}'
state: absent
with_items:
- pscx
- windirstat
- name: Install curl using proxy
win_chocolatey:
name: curl
proxy_url: http://proxy-server:8080/
proxy_username: joe
proxy_password: [email protected]
- 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
Common return values are documented here, the following are the fields unique to this module:
Key |
Returned |
Description |
---|---|---|
choco_bootstrap_output
str
|
changed, choco task returned a failure |
DEPRECATED, will be removed in 2.6, use stdout instead.
Sample:
Chocolatey upgraded 1/1 packages.
|
choco_error_cmd
str
|
changed, choco task returned a failure |
DEPRECATED, will be removed in 2.6, use command instead.
Sample:
choco.exe install -r --no-progress -y sysinternals --timeout 2700 --failonunfound
|
choco_error_log
str
|
changed, choco task returned a failure |
DEPRECATED, will be removed in 2.6, use stdout instead.
Sample:
sysinternals not installed. The package was not found with the source(s) listed
|
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.
|
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Hint
If you notice any issues in this documentation you can edit this document to improve it.