Tuesday, May 20, 2014

Configuring the Salt Master and Minion RHEL / CentOS / Scientific Linux / Amazon Linux / Oracle Linux

Installing the salt-master and salt-minion

1. Deploy 2 Virtual Machines with Ubuntu 12.04 LTS (“Precise Pangolin”). One will be the master and one will be in the minion.
2. Connect to each with PuTTy and log in with the user created during install.
Run These Commands on Both Servers:
3. Change user to root.
sudo su -
salt-001
4. Install the python-software-properties package.
apt-get install python-software-properties
salt-002
5. Add the SaltStack Repository.
add-apt-repository ppa:saltstack/salt
salt-003
6. Update the package management database.
apt-get update
salt-004
Run This Command on the salt-master Server:
7. Install salt-master.
apt-get install salt-master
salt-005
Run These Commands on the salt-minion Server:
8. Install salt-minion.
apt-get install salt-minion
salt-006
9. Edit the file /etc/salt/minion with vi. Find the line “#master: salt”. Delete the “#”. Change
“salt” to the FQDN or IP of the salt-master server.
vi /etc/salt/minion
Note: To edit the file type “i”. To save and exit type “:wq” and “enter”.
salt-007
The file should look like this:
salt-008
10. Restart the salt-minion daemon.
service salt-minion restart
salt-009
Run These Commands on the salt-master Server:
11. Add the minion’s private key to the salt-master. “-L” lists all keys. “-A” accepts all new keys.
salt-key -L
salt-key -A
salt-010
12. Test the connection with test.ping Execution Module. The result should return true.
salt "*" test.ping
salt-011
The salt-master now has the ability to remotely execute against the salt-minion. Here are a couple of simple things it can do:
Return Disk Usage:
salt "*" disk.usage
salt-012
Run Remote Commands:
salt "*" cmd.run "ls /var/log -la"
salt-013
Install the git package:
salt "*" pkg.install git
salt-014

0 comments: