AnsiblePilot — Master Ansible Automation

AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,400 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.

Popular Topics

About Luca Berton

Luca Berton is an Ansible automation expert, author of 8 Ansible books published by Apress and Leanpub including "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example", and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.

Ansible win_chocolatey Module: Install Windows Software Packages (Guide) — Video Tutorial

How to install software on Windows with Ansible win_chocolatey module (chocolatey.chocolatey.win_chocolatey). Manage packages, install, upgrade, remove.

Watch Video

Watch "Ansible win_chocolatey Module: Install Windows Software Packages (Guide)" on YouTube

What You'll Learn

Full Tutorial Content

How to Install Windows software with Ansible? Today I'm going to reveal a secret to installing the software in a Windows-managed host using [Chocolatey Package Manager](https://chocolatey.org/). I'm Luca Berton and welcome to today's episode of Ansible Pilot Ansible module win_chocolatey Chocolatey is the package manager for windows, it has the largest online registry of Windows packages. At the moment it contains nearly 9000 Community Maintained Packages. Today we're talking about Ansible module `win_chocolatey` to automate the software installation process. The full name is `chocolatey.chocolatey.win_chocolatey`, which means that is part of the collection distributed by "chocolatey". It manages packages in Windows using chocolatey. It's the windows correspondent of the ansible package module. Parameters - `name` _list_-_string_ - the name of the package - `state` _string_ - present / latest /absent /downgrade /reinstalled - `version` _string_ - specific version - `pinned` _boolean_ - no/yes - `source` _string_ - URL/path The parameter list is pretty wide but this four are the most important options. In the "`name`" parameter you are going to specify the name of the package or a list of packages. If you would like to install a specific version you could specify it in the "`version`" parameter. The state specifies the action that we would like to perform. In our case for install is "present or latest". I'd like to mention some additional parameters that might be useful for you. The "pinned" parameter allows to pin the Chocolatey package or not. Pin a package to suppress upgrades. During the next upgrade for all packages, Chocolatey will automatically skip the pinned packages. "`source`" allows specifying a local repository for packages if available. ## Playbook Are you ready to make your hands dirty? Let's jump in a quick live Playbook of a playbook about the win_chocolatey module. - win_chocolatey.yml ```yaml --- - name: win_chocolatey module Playbook hosts: all become: false gather_facts: false vars: - packages: - git - notepadplusplus tasks: - name: install packages chocolatey.chocolatey.win_chocolatey: name: "{{ packages }}" state: present ``` [code with ❤️ in GitHub](https://github.com/lucab85/ansible-pilot/tree/master/install%20a%20package%20in%20Windows%20systems) Conclusion Now you know better the Ansible module win_chocolatey and how you could use it successfully in your playbook to automate your day-to-day activities. Related Articles - [sudo and become in Ansible playbooks](/articles/ansible-become-privilege-escalation-complete-guide) - [Windows users and groups via Ansible](/articles/ansible-windows-management-complete-guide)

About This Tutorial

Read the full written article: Ansible win_chocolatey Module: Install Windows Software Packages (Guide)

Topics Covered

Related Video Tutorials