Run command on Salt master before minion highstate

saltstack

Is there a way to run a command (or state) on the salt-master whenever salt 'myminion' state.highstate is run, but before the minion's highstate is executed?

The command is svn update or (svn.latest), so there will be files in /srv/salt available to the minion. svnfs won't work for me because of directory structure constraints. I also found that you can't add custom filesystems (without modifying salt's source).

I was hoping the Reactor system would help, but I am not sure if it can be used for this case.

EDIT:
Another possible solution is to write a SVN post-commit hook, but I'd rather not.

Best Answer

You could create a custom runner that would execute your svn commands and then run your highstate as needed.

There are a lot of good example here: https://github.com/saltstack/salt/tree/develop/salt/runners

Related Topic