Saltstack Teams

If I need to execute the following 3 commands, how do I group them, so I only need to call?

salt '*' git.fetch cwd=/var/git/myproject opts='--all' user=git salt '*' git.pull cwd=/var/git/myproject opts='origin master' salt '*' nginx.signal reload 

I can use the fabric to put them in one function, say deploy , which can take the name of the minion and then run through master, but I wonder if there is anything built-in in the salt box?

+6
source share
1 answer

This is a good candidate for a custom module.

Here you can read about creating custom modules: http://docs.saltstack.com/ref/modules/index.html . Put your custom module in / srv / salt / _modules (default location) and then run

 salt \* saltutil.sync_modules 

Then your module will be available to launch your minions.

If your module is called "deploy" and the function is "mysite", your user command will look like this:

 salt \* deploy.mysite 

If you want to target a specific minion, it will look like this:

 salt 'minion_name' deploy.mysite 
+6
source

All Articles