Ansible installing package using Chocolatey in windows

Chocolatey is a package manager for Windows, it makes automating software installation, configuration, and uninstallation easier by wrapping the underlying installation technologies in an easy-to-use command-line syntax.

Using with Ansible

Ansible has the module win_chocolatey that will install chocolatey packages from Ansible playbooks. If on the first run through Ansible detects that chocolatey is not installed, it will install chocolatey as part of the task.

ansible-playbook for installing git on our windows target machine.

# cat windowschoco.yml


- hosts: all

gather_facts: no


- name: Install git


name: git

state: present

Let's run the playbook,

# ansible-playbook -i hosts windowschoco.yaml

PLAY [all] **************************************************************************************************************************************************

TASK [Install git] ******************************************************************************************************************************************

changed: []

PLAY RECAP ************************************************************************************************************************************************** : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

Github repo for:

Recent Comments

No comments

Leave a Comment