Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sample salt commands to be run from a salt master. These commands have been tested with salt 2017.7.4 (Nitrogen).
# install a tool in all minions connected to a salt master.
sudo salt '*' cmd.run 'sudo apt-get install nmon -y'
# run a linux command in all minions connected to a salt master.
sudo salt '*' cmd.run 'date'
# check if a system reboot is required in all minions connected to a salt master.
sudo salt '*' system.get_reboot_required_witnessed
# get minion hostname in all minions connected to a salt master.
sudo salt '*' network.get_hostname
# install python3 to enable pip to run in all minions connected to a salt master.
sudo salt '*' cmd.run 'sudo apt-get install python3-pip -y'
# install a python module in all minions connected to a salt master.
sudo salt '*' cmd.run 'pip3 install progressbar'
# test a echo message from all minions connected to a salt master.
sudo salt '*' test.echo 'hello'
# ping each minion connected to a salt master.
sudo salt '*' test.ping
# get minion environment details from all minions connected to a salt master.
sudo salt '*' grains.items --output=pprint
# update and upgrade linux packages in multiple servers simultaneously. all server names should have the string 'node' in them.
sudo salt '*node*' cmd.run ' sudo apt-get update | sudo apt-get upgrade -y ' --output=pprint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.