ansible.builtin.win_chocolatey (v2.4.0.0-1) — module

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)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.4.0.0.post1

Description

Manage packages using Chocolatey (U(http://chocolatey.org/)).

If Chocolatey is missing from the system, the module will install it.

List of packages can be found at U(http://chocolatey.org/packages).


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install git
  win_chocolatey:
    name: git
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Upgrade installed packages
  win_chocolatey:
    name: all
    state: latest
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install notepadplusplus version 6.6
  win_chocolatey:
    name: notepadplusplus.install
    version: '6.6'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install git from specified repository
  win_chocolatey:
    name: git
    source: https://someserver/api/v2/
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Uninstall git
  win_chocolatey:
    name: git
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: install multiple packages
  win_chocolatey:
    name: '{{ item }}'
    state: absent
  with_items:
  - pscx
  - windirstat
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: uninstall multiple packages
  win_chocolatey:
    name: '{{ item }}'
    state: absent
  with_items:
  - pscx
  - windirstat
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install curl using proxy
  win_chocolatey:
    name: curl
    proxy_url: http://proxy-server:8080/
    proxy_username: joe
    proxy_password: p@ssw0rd
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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

Inputs

    
name:
    description:
    - Name of the package to be installed.
    - This must be a single package name.
    required: true

force:
    default: 'no'
    description:
    - Forces install of the package (even if it already exists).
    - Using C(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.

params:
    description:
    - Parameters to pass to the package
    version_added: '2.1'
    version_added_collection: ansible.builtin

source:
    description:
    - Specify source rather than using default chocolatey repository.

timeout:
    aliases:
    - execution_timeout
    default: 2700
    description:
    - The time to allow chocolatey to finish before timing out.
    version_added: '2.3'
    version_added_collection: ansible.builtin

upgrade:
    default: 'no'
    description:
    - 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 C(state) to C(latest) for the
      same result.
    type: bool

version:
    description:
    - Specific version of the package to be installed.
    - Ignored when C(state) is set to C(absent).

proxy_url:
    description:
    - Proxy url used to install chocolatey and the package.
    version_added: '2.4'
    version_added_collection: ansible.builtin

install_args:
    description:
    - Arguments to pass to the native installer.
    version_added: '2.1'
    version_added_collection: ansible.builtin

skip_scripts:
    default: 'no'
    description:
    - Do not run I(chocolateyInstall.ps1) or I(chocolateyUninstall.ps1) scripts.
    type: bool
    version_added: '2.4'
    version_added_collection: ansible.builtin

proxy_password:
    description:
    - Proxy password used to install chocolatey and the package.
    - See notes in C(proxy_username) when dealing with double quotes in a password.
    version_added: '2.4'
    version_added_collection: ansible.builtin

proxy_username:
    description:
    - Proxy username used to install chocolatey and the package.
    - When dealing with a username with double quote characters C("), they need to be
      escaped with C(\) beforehand. See examples for more details.
    version_added: '2.4'
    version_added_collection: ansible.builtin

ignore_checksums:
    default: 'no'
    description:
    - Ignore checksums altogether.
    type: bool
    version_added: '2.2'
    version_added_collection: ansible.builtin

ignore_dependencies:
    default: 'no'
    description:
    - Ignore dependencies, only install/upgrade the package itself.
    type: bool
    version_added: '2.1'
    version_added_collection: ansible.builtin

allow_empty_checksums:
    default: 'no'
    description:
    - Allow empty checksums to be used.
    type: bool
    version_added: '2.2'
    version_added_collection: ansible.builtin

Outputs

choco_bootstrap_output:
  description: DEPRECATED, will be removed in 2.6, use stdout instead.
  returned: changed, choco task returned a failure
  sample: Chocolatey upgraded 1/1 packages.
  type: str
choco_error_cmd:
  description: DEPRECATED, will be removed in 2.6, use command instead.
  returned: changed, choco task returned a failure
  sample: choco.exe install -r --no-progress -y sysinternals --timeout 2700 --failonunfound
  type: str
choco_error_log:
  description: DEPRECATED, will be removed in 2.6, use stdout instead.
  returned: changed, choco task returned a failure
  sample: sysinternals not installed. The package was not found with the source(s)
    listed
  type: str
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: changed
  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