Architecture:
- There is a master server and it connects to the agent servers (called minions) in your infrastructure.
- The master can run commands in the minions parallelly, it is what make salt very fast.
- The minions will execute the command sent by master and return it.
There are few concepts associated with salt.
Also Read: Opscode Chef Configuration Management tool setup
Returners: Using which you can redirect the return object of executed code to any system which can accept data, like reddis, mongodb, or a PostgresSQL database.
Reactor sit up in the master. You can configure the reactor to list to the events .When the minions fire some events to the even bus in the salt master , the reactor handles the event by taking necessary actions based up the conditions set in the reactor. For example , if Jenkins is running on one of the minions and it fires an event to master saying the build has finished, the reactor in turn handles the event and redirect to another minion to take actions based on the Jenkins successful build.
GitFS:
In salt you can git as a source repository and pull the source files to server them to minions.
In this tutorial, am goin to set the salt master in RHEL and salt minion in Ubuntu 13.04.
Setting up salt master on RHEL6:
1. Enable the EPEL repo
rpm -Uvh http://ftp.linux.ncsu.edu/pub/epel/6/i386/epel-release-6-8.noarch.rpm
2. Install the salt master package using yum
Yum install salt-master
3. Set the salt-master service to start on system boot
Chkconfig salt-master on
4. Start the salt master
Service salt-master start
Setting up salt minion on Ubuntu server:
If you want both the master and minion in one server, you can install the minion in the same server using yum command. Here am going to use a separate server for installing minion.
1. Add the salt repository
sudo add-apt-repository ppa:saltstack/salt
2. Update the repo database
apt-get update
3. Install salt minion
apt-get install salt-minion
Configuring salt Master:
By default salt master listens to post 4505 and 4506. So make sure these ports are open in Iptables and any firewall if any. If you are using AWS instance , make sure these ports are open in the security groups.
Configuring salt minion:
By default salt minion listens to 4505 and 4506 , so make these ports are opened as mentioned above.
Open the /etc/salt/minion and uncomment the master option and give your masters ip
master : ip of master
By default you have the hostname “salt”. You can use the same name if you edit your /etc/hosts file and make an entry for your salt master with name “salt”.
Registering minion with the master:
1. Start the minion
salt-minion
2. The above command will contact the master with keys for authentication.
3. Go to salt master and issue the following command to see it has any requests for authentication from new minions.
salt-key –L
4. You will see the hostame of the minion under unauthorized keys.
5. Accept the keys using the following command
salt-key -a
6. Once you accept the keys from minion , it will be registered with the master and the master can now issue commands to the minion.
7. You can list the minions using the following commands.
salt-run manage.up
salt-run manage.status
salt-run manage.down
Testing master minion connection:
1. You can check the master minion connection using the simple salt ping test. It gives you output as “true”
salt <minion-name> test:ping
Managing Keys:
If you want to re-register a minion to the master delete the existing minion key from the master using the following command
salt-key –d minion-name
Restart the minion after deleting the key and start it again to register it with new keys.
Salt has a GUI called Halite, which is in pre-alpha stage.
Kindly share the article and leave a comment for queries.