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.
|
allow_prerelease
(added in 2.6) |
|
Allow install of prerelease packages.
If state
state is latest the highest prerelease package will be installed. |
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 |
version |
Specific version of the package to be installed.
Ignored when
state is set to absent . |
Note
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 become 6,1
, which will cause a failure.-vv
) the stdout
output will be restricted.-vvvv
) the stdout
output will be more verbose.-vvvvv
) the stdout
output will include debug output.become
) to achieve this.become
) to become Administrator will give you an interactive user logon, see examples below.- 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
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.
|
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.