Salt Remote execution & config
Light · Postcard
102 × 152 mm · PDF
Dark · Postcard
102 × 152 mm · PDF
Ink saver · Postcard
102 × 152 mm · PDF
Light · A4 landscape
297 × 210 mm · PDF
Dark · A4 landscape
297 × 210 mm · PDF
Ink saver · A4 landscape
297 × 210 mm · PDF
Light · A3 landscape
420 × 297 mm · PDF
Dark · A3 landscape
420 × 297 mm · PDF
Ink saver · A3 landscape
420 × 297 mm · PDF
Start here
salt '*' test.ping
salt '<target>' cmd.run
"<cmd>"
salt-key -Lsalt-key -a <id>
salt '<target>' state.apply test=True
salt '<target>' state.apply
salt '<target>' grains.items
salt-call --local <function>
Concepts
- salt (master) you type commands
- Minions matched by ID, grain, pillar
- Modules / states cmd.run, pkg.install, state.apply
Running Commands
salt '<target>' <module.function>
[args]
salt '*' test.ping
salt '<target>' cmd.run
"<cmd>"
salt '<target>' sys.doc <module>
salt '<target>' saltutil.sync_all
Targeting
salt 'web*' <fn>
salt -L 'a,b,c' <fn>
salt -E 'web[0-9]+' <fn>
salt -G 'os:Ubuntu' <fn>
salt -I 'role:db' <fn>
salt -N <nodegroup> <fn>
salt -C 'G@os:Ubuntu and web* not L@web9'
<fn>
salt -b 10% '<target>' <fn>
States
salt '<target>' state.apply
salt '<target>' state.apply test=True
salt '<target>' state.apply <sls>
salt '<target>' state.show_highstate
salt '<target>' state.show_sls
<sls>
salt --state-output=changes '<target>'
state.apply
Packages & Services
salt '<target>' pkg.install <pkg>
salt '<target>' pkg.remove <pkg>
salt '<target>' pkg.list_pkgs
salt '<target>' service.status
<svc>
salt '<target>' service.restart
<svc>
salt '<target>' service.enable
<svc>
Grains & Pillar
salt '<target>' grains.items
salt '<target>' grains.get <key>
salt '<target>' grains.setval <key>
<val>
salt '<target>' pillar.items
salt '<target>' pillar.get <key>
salt '<target>' saltutil.refresh_pillar
Keys
salt-key -Lsalt-key -a <id>
salt-key -d <id>
salt-key -f <id>
salt-call & salt-run
salt-call --local <fn>
salt-call state.apply test=True
salt-call --local state.apply <sls> -l debug
salt-call --out=json <fn>
salt-run manage.up
salt-run jobs.active
salt-run jobs.list_jobs
salt-run jobs.lookup_jid <jid>
salt --async '<target>' <fn>
Output & Options
salt --out=json '<target>' <fn>
salt -t <seconds> '<target>'
<fn>
salt --versions-report
Recipes
salt 'web*' state.apply nginx test=Truesalt -b 25% 'web*' state.apply nginxsalt 'web*' service.status nginx
# on the minion: id in /etc/salt/minion_idsystemctl restart salt-minion# on the mastersalt-key -Lsalt-key -a web1salt 'web1' test.ping
# /srv/salt/top.slsbase: 'web*': - nginx# /srv/salt/nginx.slsnginx: pkg.installed: [] service.running: - enable: True
salt -C 'G@os:Ubuntu and I@role:web' pkg.version nginxsalt-run manage.downsalt-run jobs.list_jobs



