Last active
March 21, 2018 18:29
-
-
Save juanbrny/a33a920d390b3c69afe6abb7f729965f to your computer and use it in GitHub Desktop.
Sample Salt commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh root@susemanager.suselab.com | |
////////////////////////////////////// | |
// | |
// SUSE EXPERT DAYS 2018 | |
// SOME SAMPLE SALT COMMANDS | |
// | |
////////////////////////////////////// | |
//Check status | |
salt-run manage.status | |
salt '*' test.ping | |
//Get grains from all minions | |
salt '*' grains.ls | |
//OS data | |
salt '*' grains.fetch os | |
salt 'caaslocal.suselab.com' grains.append net extranet | |
salt '*.tf.local' grains.append net intranet | |
//Get grains value | |
salt '*' grains.fetch net | |
//Example module: network | |
salt '*' network.interface eth0 | |
salt '*' network.interfaces | |
//Playing with output | |
salt '*' network.interface | |
salt '*' network.interfaces --output=json | |
salt -G "net:intranet" test.ping | |
salt -G "net:extranet" test.ping | |
salt -G "net:*tranet" grains.fetch net | |
//Debugging and auditing | |
salt '*' status.diskusage | |
salt '*' status.loadavg | |
salt '*' grains.fetch num_cpus | |
//Advanced targeting | |
//Free RAM for SUSE servers on the intranet 1 CPU | |
salt -C 'G@os:SUSE and G@num_cpus:1 and *.local' test.ping | |
//Remote command execution | |
salt -C 'G@os:SUSE and G@num_cpus:1 and *.local' cmd.run 'cat /proc/cpuinfo | grep "model name"' | |
salt -C 'G@os:SUSE and G@num_cpus:1 and *.local' grains.fetch cpu_model | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment