Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
salt
Readme.md
Vagrantfile
bootstrap-master.sh
minion-setup.ps1

Readme.md

All the following commands if run are run from the salt master.

Master accept minions

Accept All

salt-key –A

Delete All

salt-key –D

Once a minion is accepted you should refresh its package list

salt '*' pkg.refresh_db

Add a minion to a Grain/Role

Review http://docs.saltstack.com/en/latest/topics/targeting/grains.html

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

On Windows

  • Open services.msc
  • find salt-minion service
  • restart

On linux

sudo salt-minion -d

Execute execution modules in state sls files

See http://docs.saltstack.com/en/latest/ref/states/all/salt.states.module.html#module-salt.states.module

Target Machines based on Roles

See http://www.saltstat.es/posts/role-infrastructure.html

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

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

or

salt-call state.show_highstate

Live Site

Upload states to master server in the folder

/srv/salt

When uploading the files use an scp client (filezille, or whatever).

Upload the full contents of the local folder /salt/*.