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

1070 views
Skip to first unread message

Urs Rau

unread,
Feb 5, 2015, 4:07:17 AM2/5/15
to salt-...@googlegroups.com
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

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


-Loren

Dan Sheridan

unread,
Feb 9, 2015, 5:43:19 AM2/9/15
to salt-...@googlegroups.com
Yes. For my Windows minions I have states that look like this:

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

There's a ticket open about doing this properly: https://github.com/saltstack/salt/issues/15709 and some ongoing discussion in https://github.com/saltstack/salt/issues/20245

Dan.

dragon788

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


Installsomepackage:
 
chocolatey.installed:
   
- name: packagename
   
- version: '12.04'
   
- source: 'mychocolatey/source'
   
- force: True

Adrian Sekowski

unread,
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 (techneg.it)

unread,
Aug 18, 2022, 9:38:32 AMAug 18
to salt-...@googlegroups.com
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.

HTH,
Dafydd

--
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 salt-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/salt-users/dc7ac58d-9270-43c1-a56e-f8abe8fbd02dn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages