When you are in a situation where you need your configuration managment to be client/server saltstack is a good choice instead of ansible.
All the following commands if run are run from the salt master.
apt-get install -y python-software-properties add-apt-repository ppa:saltstack/salt -y apt-get update apt-get install -y salt-master service salt-master restart
This will get a SaltStack master server up and running. From this point you can configure it any way you want.
See the SaltStack example for more configuration options.
Master accept minions
Once a minion is accepted you should refresh its package list
salt '*' pkg.refresh_db
Add a minion to a Grain/Role
Minion config file: C:\salt\conf\minion
Find the section that looks like the following and add your new role.
grains: roles: - IISStaging
That could become the following if we added a new role called PowerShellExample.
grains: roles: - IISStaging - PowerShellExample
After saving restart the salt minion with
- Open services.msc
- find salt-minion service
sudo salt-minion -d
Execute execution modules in state sls files
Target Machines based on Roles
Run command on all minions
salt '*' test.ping
Run command on only ubuntu servers
salt -C 'G@os:Ubuntu' test.ping
Run command on only IIS servers
salt -C 'G@roles:IISStaging' test.ping
Apply State to all servers
salt '*' state.highstate
Apply State to particular environments
salt '*' state.highstate env=base
The top.sls file can have multiple environments. By default this example only has 1 called base.
Trigger run on all grains with the role NginxStaging Updates
salt -C 'G@roles:NginxStaging' state.highstate
Refresh Git WinRepo
salt-run winrepo.update_git_repos salt-run winrepo.genrepo salt '*' pkg.refresh_db
Debug High State Errors
Call the following from a minion
salt-call -l debug state.highstate
Upload states to master server in the folder
When uploading the files use an scp client (filezille, or whatever).
Upload the full contents of the local folder /salt/*.