ansible / ansible.builtin / v2.9.23 / module / win_chocolatey Manage packages using chocolatey | "added in version" 1.9 of ansible.builtin" Authors: Trond Hindenes (@trondhindenes), Peter Mounce (@petemounce), Pepe Barbe (@elventear), Adam Keech (@smadam813), Pierre Templier (@ptemplier), Jordan Borean (@jborean93) preview | supported by communityansible.builtin.win_chocolatey (v2.9.23) — module
pip
Install with pip install ansible==2.9.23
Manage packages using Chocolatey.
If Chocolatey is missing from the system, the module will install it.
- 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 notepadplusplus 32 bit version win_chocolatey: name: notepadplusplus architecture: x86
- name: Install git from specified repository win_chocolatey: name: git source: https://someserver/api/v2/
- name: Install git from a pre configured source (win_chocolatey_source) win_chocolatey: name: git source: internal_repo
- name: Ensure Chocolatey itself is installed and use internal repo as source win_chocolatey: name: chocolatey source: http://someserver/chocolatey
- name: Uninstall git win_chocolatey: name: git state: absent
- name: Install multiple packages win_chocolatey: name: - procexp - putty - windirstat state: present
- name: Install multiple packages sequentially win_chocolatey: name: '{{ item }}' state: present loop: - procexp - putty - windirstat
- name: Uninstall multiple packages win_chocolatey: name: - procexp - putty - windirstat state: absent
- name: Install curl using proxy win_chocolatey: name: curl proxy_url: http://proxy-server:8080/ proxy_username: joe proxy_password: p@ssw0rd
- name: Install a package that requires 'become' win_chocolatey: name: officepro2013 become: yes become_user: Administrator become_method: runas
- name: install and pin Notepad++ at 7.6.3 win_chocolatey: name: notepadplusplus version: 7.6.3 pinned: yes state: present
- name: remove all pins for Notepad++ on all versions win_chocolatey: name: notepadplusplus pinned: no state: present
name: description: - Name of the package(s) to be installed. - Set to C(all) to run the action on all the installed packages. required: true type: list force: default: false description: - Forces the install of a package, even if it already is installed. - Using I(force) will cause Ansible to always report that a change was made. type: bool state: choices: - absent - downgrade - latest - present - reinstalled default: present description: - State of the package on the system. - When C(absent), will ensure the package is not installed. - When C(present), will ensure the package is installed. - When C(downgrade), will allow Chocolatey to downgrade a package if I(version) is older than the installed version. - When C(latest), will ensure the package is installed to the latest available version. - When C(reinstalled), will uninstall and reinstall the package. type: str pinned: description: - Whether to pin the Chocolatey package or not. - If omitted then no checks on package pins are done. - Will pin/unpin the specific version if I(version) is set. - Will pin the latest version of a package if C(yes), I(version) is not set and and no pin already exists. - Will unpin all versions of a package if C(no) and I(version) is not set. - This is ignored when C(state=absent). type: bool version_added: '2.8' version_added_collection: ansible.builtin source: description: - Specify the source to retrieve the package from. - Use M(win_chocolatey_source) to manage global sources. - This value can either be the URL to a Chocolatey feed, a path to a folder containing C(.nupkg) packages or the name of a source defined by M(win_chocolatey_source). - This value is also used when Chocolatey is not installed as the location of the install.ps1 script and only supports URLs for this case. type: str timeout: aliases: - execution_timeout default: 2700 description: - The time to allow chocolatey to finish before timing out. type: int version_added: '2.3' version_added_collection: ansible.builtin version: description: - Specific version of the package to be installed. - When I(state) is set to C(absent), will uninstall the specific version otherwise all versions of that package will be removed. - If a different version of package is installed, I(state) must be C(latest) or I(force) set to C(yes) to install the desired version. - Provide as a string (e.g. C('6.1')), otherwise it is considered to be a floating-point number and depending on the locale could become C(6,1), which will cause a failure. - If I(name) is set to C(chocolatey) and Chocolatey is not installed on the host, this will be the version of Chocolatey that is installed. You can also set the C(chocolateyVersion) environment var. type: str proxy_url: description: - Proxy URL used to install chocolatey and the package. - Use M(win_chocolatey_config) with the name C(proxy) to control this option globally. type: str version_added: '2.4' version_added_collection: ansible.builtin architecture: choices: - default - x86 default: default description: - Force Chocolatey to install the package of a specific process architecture. - When setting C(x86), will ensure Chocolatey installs the x86 package even when on an x64 bit OS. type: str version_added: '2.7' version_added_collection: ansible.builtin install_args: description: - Arguments to pass to the native installer. - These are arguments that are passed directly to the installer the Chocolatey package runs, this is generally an advanced option. type: str version_added: '2.1' version_added_collection: ansible.builtin skip_scripts: default: false description: - Do not run I(chocolateyInstall.ps1) or I(chocolateyUninstall.ps1) scripts when installing a package. type: bool version_added: '2.4' version_added_collection: ansible.builtin allow_multiple: default: false description: - Allow the installation of multiple packages when I(version) is specified. - Having multiple packages at different versions can cause issues if the package doesn't support this. Use at your own risk. type: bool version_added: '2.8' version_added_collection: ansible.builtin package_params: aliases: - params description: - Parameters to pass to the package. - These are parameters specific to the Chocolatey package and are generally documented by the package itself. - Before Ansible 2.7, this option was just I(params). type: str version_added: '2.1' version_added_collection: ansible.builtin proxy_password: description: - Proxy password used to install Chocolatey and the package. - This value is exposed as a command argument and any privileged account can see this value when the module is running Chocolatey, define the password on the global config level with M(win_chocolatey_config) with name C(proxyPassword) to avoid this. type: str version_added: '2.4' version_added_collection: ansible.builtin proxy_username: description: - Proxy username used to install Chocolatey and the package. - Before Ansible 2.7, users with double quote characters C(") would need to be escaped with C(\) beforehand. This is no longer necessary. - Use M(win_chocolatey_config) with the name C(proxyUser) to control this option globally. type: str version_added: '2.4' version_added_collection: ansible.builtin validate_certs: default: true description: - Used when downloading the Chocolatey install script if Chocolatey is not already installed, this does not affect the Chocolatey package install process. - When C(no), no SSL certificates will be validated. - This should only be used on personally controlled sites using self-signed certificate. type: bool version_added: '2.7' version_added_collection: ansible.builtin source_password: description: - The password for I(source_username). - This value is exposed as a command argument and any privileged account can see this value when the module is running Chocolatey, define the credentials with a source with M(win_chocolatey_source) to avoid this. type: str version_added: '2.7' version_added_collection: ansible.builtin source_username: description: - A username to use with I(source) when accessing a feed that requires authentication. - It is recommended you define the credentials on a source with M(win_chocolatey_source) instead of passing it per task. type: str version_added: '2.7' version_added_collection: ansible.builtin allow_prerelease: default: false description: - Allow the installation of pre-release packages. - If I(state) is C(latest), the latest pre-release package will be installed. type: bool version_added: '2.6' version_added_collection: ansible.builtin ignore_checksums: default: false description: - Ignore the checksums provided by the package. - Use M(win_chocolatey_feature) with the name C(checksumFiles) to control this option globally. type: bool version_added: '2.2' version_added_collection: ansible.builtin ignore_dependencies: default: false description: - Ignore dependencies, only install/upgrade the package itself. type: bool version_added: '2.1' version_added_collection: ansible.builtin allow_empty_checksums: default: false description: - Allow empty checksums to be used for downloaded resource from non-secure locations. - Use M(win_chocolatey_feature) with the name C(allowEmptyChecksums) to control this option globally. type: bool version_added: '2.2' version_added_collection: ansible.builtin
command: description: The full command used in the chocolatey task. returned: changed sample: choco.exe install -r --no-progress -y sysinternals --timeout 2700 --failonunfound type: str rc: description: The return code from the chocolatey task. returned: always sample: 0 type: int stdout: description: The stdout from the chocolatey task. The verbosity level of the messages are affected by Ansible verbosity setting, see notes for more details. returned: changed sample: Chocolatey upgraded 1/1 packages. type: str