Install Windows software - Ansible module win_chocolatey
How to Install Windows software with Ansible? Today I’m going to reveal a secret to installing software in a Windows managed host using Chocolatey Package Manager.


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. 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.
The Best Resources For Ansible
Certifications
Video Course
Printed Book
eBooks
Ansible by Examples: 200+ Automation Examples For Linux and Windows System Administrator and DevOps
Ansible Cookbook: A Comprehensive Guide to Unleashing the Power of Ansible via Best Practices, Troubleshooting, and Linting Rules with Luca Berton
Ansible For Windows By Examples: 50+ Automation Examples For Windows System Administrator And DevOps
Ansible For Linux by Examples: 100+ Automation Examples For Linux System Administrator and DevOps
Ansible Linux Filesystem By Examples: 40+ Automation Examples on Linux File and Directory Operation for Modern IT Infrastructure
Ansible For Security by Examples: 100+ Automation Examples to Automate Security and Verify Compliance for IT Modern Infrastructure
Ansible Tips and Tricks: 10+ Ansible Examples to Save Time and Automate More Tasks
Ansible Linux Users & Groups By Examples: 20+ Automation Examples on Linux Users and Groups Operation for Modern IT Infrastructure
Ansible For PostgreSQL by Examples: 10+ Examples To Automate Your PostgreSQL database
Ansible For Amazon Web Services AWS By Examples: 10+ Examples To Automate Your AWS Modern Infrastructure
Ansible Automation Platform By Example: A step-by-step guide for the most common user scenarios
demo
Are you ready to make your hands dirty? Let’s jump in a quick live demo of a playbook about the win_chocolatey module.
- win_chocolatey.yml
---
- name: win_chocolatey module demo
hosts: all
become: false
gather_facts: false
vars:
- packages:
- git
- notepadplusplus
tasks:
- name: install packages
chocolatey.chocolatey.win_chocolatey:
name: "{{ packages }}"
state: present
Recap
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. Subscribe to the YouTube channel, Medium, Website, Twitter, and Substack to not miss the next episode of the Ansible Pilot.
Academy
Learn the Ansible automation technology with some real-life examples in my
My book Ansible By Examples: 200+ Automation Examples For Linux and Windows System Administrator and DevOps
Donate
Want to keep this project going? Please donate