how to use salt chocolatey module to manage windows minion state?

Skip to first unread message

Urs Rau

Feb 5, 2015, 4:07:17 AM2/5/15
Much to my surprise, I found that there is a salt module for chocolatey. Thanks! This works great for installing, uninstalling and listing pkgs of software for windows. In fact chocolatey is very very close to a proper apt-get or yum software package manager but for windows.

But how do I now use this to write salt state into sls files along the usual salt syntax to install certain versions of software packages?

AFAIK the windows minion only use salt-winrepo to add or remove software. What switch do I have to flick, for it to use the chocolatey module to install and remove the software packages using the relevant salt chocolatey module cmd?

On the master I can do

salt ‘my-winpc-1’ chocolatey bootstrap

and this installed chocolatey if needed.

after that I can install software such as the notepad++ editor as simply as
salt ‘my-winpc-1’ chocolatey.install npp

and it goes and installs the notepad++ pkg on my-winpc-1 minion

but where do i put my state sls file that says I want ‘npp’ installed on my-winpc-1?

Thanks for any help, or an example on how to achieve this for installing notepad++ on the windows minion my-winpc-1?

PS: I case you didn’t know about it, like me, here is the salt module for chocolatey

Loren Gordon

Feb 5, 2015, 6:17:44 AM2/5/15
As it doesn't appear there is a corresponding chocolatey state, you could use `` in a state to execute the chocolatey module.


Dan Sheridan

Feb 9, 2015, 5:43:19 AM2/9/15
Yes. For my Windows minions I have states that look like this:

    - shell: powershell
    - onlyif: 'exit (choco list -localonly | Select-String -Quiet "adobereader") '
    - name: 'cinst adobereader'

There's a ticket open about doing this properly: and some ongoing discussion in



Dec 16, 2016, 3:43:05 PM12/16/16
to Salt-users
You can now use states with Chocolatey to install packages.

- name: packagename
- version: '12.04'
- source: 'mychocolatey/source'
- force: True

Adrian Sekowski

Aug 16, 2022, 1:51:04 PMAug 16
to Salt-users
How to use some specific options like changing installation path or placing extra features? I can't find good examples for windows. 

Dafydd Jones (

Aug 18, 2022, 9:38:32 AMAug 18
Hi Adrian,

the chocolatey state module has the arguments install_args and package_args which allow you to customize the installation.

For further detail you would have to look at the documentation for the specific Chocolatey package.


You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages