SaltStack, also known as Salt, is a powerful configuration management and orchestration tool that uses a central master to manage nodes, which are called minions. Salt can execute commands across multiple systems simultaneously, allowing for fast and scalable automation. Below, I'll outline how to set up basic operations in SaltStack and provide examples of how to use it for various tasks.
Install Salt Master:
On Ubuntu:
sudo apt-get update
sudo apt-get install salt-master
Install Salt Minion:
On Ubuntu:
sudo apt-get install salt-minion
Configure Minion:
Set the master IP in the minion configuration file (/etc/salt/minion
):
master: ip_of_salt_master
Start Services:
Start the Salt master and minion services:
sudo systemctl start salt-master
sudo systemctl start salt-minion
Accept Minion Keys:
On the master, accept the minion keys:
sudo salt-key -A
To test if your minions are properly connected and responding to the master:
salt '*' test.ping
This command should return True
for each minion that is up and connected to the master.
You can execute commands on all or specific minions:
salt '*' cmd.run 'uptime'
This command runs the uptime
command on all connected minions.