Examples of managing Windows services with states?

31 views
Skip to first unread message

Fredrik Averpil

unread,
Feb 9, 2016, 2:40:36 AM2/9/16
to salt-...@googlegroups.com
Hi,

I'm new to Salt and having a bit of a hard time to wrap my head around how I can manage Windows services and nest requires/watch conditions. I assume the win_service module is the way to go to manage services as I want to do the following:

- Make sure a service is installed and running
- If it is not installed or of wrong version, (possibly uninstall and) install the proper version
- The service requires access to a configuration file, and if this file is not available, it needs to be copied onto the minion (preferably from the salt master)
- A specific port must be open in the firewall, and if not, a rule needs to be added

Is there a recommended approach on how to add this kind of service to a highstate?

The service installer is not provided via a package manager, and must be installed/uninstalled from .msi.

Any suggestions are very much appreciated.

Regards,
Fredrik


Megan Wilhite

unread,
Feb 10, 2016, 11:33:21 AM2/10/16
to Salt-users
You can use saltstacks windows software repository documented here: https://docs.saltstack.com/en/latest/topics/windows/windows-package-manager.html to install the packages.

Does that help clarify everything?

Fredrik Averpil

unread,
Feb 11, 2016, 4:03:26 AM2/11/16
to Salt-users
Yes, I believe I solved everything by creating a custom win_repo pkg for my application. 

The Windows Software Repository packages are located in /srv/salt/win/repo-ng/salt-winrepo-ng

I created a custom package for my specific application. Unfortunately, it doesn't make sense to push this to the official repository as the binary installer isn't available online and is created by a third-party vendor.

Is there a prefered place where I can place such custom packages for the Windows Software Repository?
Right now I've placed it into /srv/salt/win/repo-ng/salt-winrepo-ng  ...but that doesn't feel too clean. I would have wanted to put it inside e.g. /srv/salt/_win_repo or something. I know I can create a full-blown git repo and include that, but that's a bit overkill at the moment.

Thanks,
Fredrik

--
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.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages