User:Ema/Salt

From Wikitech


  1. Login into neodymium.eqiad.wmnet to run salt commands
  2. sudo needed
  3. --out=txt for greppable output

All nodes running Varnish 4

sudo salt --out=txt -C 'G@varnish_version:4' cmd.run hostname

Nodes running Debian Jessie

sudo salt --out=txt -v -C 'G@oscodename:jessie' cmd.run hostname

All text nodes in codfw

salt -C 'G@cluster:cache_text and G@site:codfw' cmd.run 'hostname --fqdn'

Misc in esams and ulsfo

salt -C 'G@cluster:cache_misc and ( G@site:ulsfo or G@site:esams )' cmd.run 'hostname --fqdn'

Batch mode, 4 at a time

salt -b 4 -C 'G@cluster:cache_misc' cmd.run 'date'

Rolling nginx restart in batch mode, 1 at a time

 salt -b 1 -C 'G@cluster:cache_*' cmd.run 'service nginx configtest && service nginx restart && sleep 5'

Hostname matcher

sudo salt 'cp*' cmd.run 'uname -a'

Ping all hosts with a certain role

salt -G debdeploy-spare:standard test.ping

Icinga error about salt-minion not running

salt-key -d hostname.dc.wmnet
salt-key -a hostname.dc.wmnet