win_chocolatey – Manage packages using chocolatey¶
Synopsis¶
- Manage packages using Chocolatey.
- If Chocolatey is missing from the system, the module will install it.
Requirements¶
The below requirements are needed on the host that executes this module.
- chocolatey >= 0.10.5 (will be upgraded if older)
Parameters¶
Notes¶
Note
- This module will install or upgrade Chocolatey when needed.
- 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. - Some packages, like hotfixes or updates need an interactive user logon in order to install. You can use
become
to achieve this, see Become and Windows. Even if you are connecting as local Administrator, usingbecome
to become Administrator will give you an interactive user logon, see examples below. - If
become
is unavailable, use win_hotfix to install hotfixes instead of win_chocolatey as win_hotfix avoids usingwusa.exe
which cannot be run withoutbecome
.
See Also¶
See also
- win_chocolatey_config – Manages Chocolatey config settings
- The official documentation on the win_chocolatey_config module.
- win_chocolatey_facts – Create a facts collection for Chocolatey
- The official documentation on the win_chocolatey_facts module.
- win_chocolatey_feature – Manages Chocolatey features
- The official documentation on the win_chocolatey_feature module.
- win_chocolatey_source – Manages Chocolatey sources
- The official documentation on the win_chocolatey_source module.
- win_feature – Installs and uninstalls Windows Features on Windows Server
- The official documentation on the win_feature module.
- win_hotfix – Install and uninstalls Windows hotfixes
- Use when
become
is unavailable, to avoid usingwusa.exe
. - win_package – Installs/uninstalls an installable package
- The official documentation on the win_package module.
- win_updates – Download and install Windows updates
- The official documentation on the win_updates module.
- Chocolatey website
- More information about the Chocolatey tool.
- Chocolatey packages
- An overview of the available Chocolatey packages.
- Become and Windows
- Some packages, like hotfixes or updates need an interactive user logon in order to install. You can use
become
to achieve this.
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 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
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Status¶
- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]
Authors¶
- Trond Hindenes (@trondhindenes)
- Peter Mounce (@petemounce)
- Pepe Barbe (@elventear)
- Adam Keech (@smadam813)
- Pierre Templier (@ptemplier)
- Jordan Borean (@jborean93)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.