OpenSource For You

Infrastruc­ture Management Made Easy with Salt Stack

The tremendous success of technologi­es like virtualisa­tion and cloud computing has made infrastruc­ture management a more challengin­g task for system administra­tors. This article introduces a simple and powerful tool called Salt Stack for infrastruc­ture ma

-

Earlier, systems administra­tors had to visit each and every server to install or configure any software. This particular style of infrastruc­ture management was very tedious and time consuming. Back then, administra­tors would remotely log in, a practice that was very successful for some time. Secure Shell (SSH) is a fine example for accessing a remote server. But administra­tors then had to establish a remote connection with every server and issue commands separately to each one. In the current cloud computing era, administra­tors use automation tools that can perform policy based configurat­ions and installati­ons on all the servers at once, automatica­lly. For this purpose, there are a few useful open source tools like Salt Stack, Puppet, Chef, etc.

An introducti­on to Salt Stack

Salt (Salt-Stack) is an infrastruc­ture automation and management system coded in Python by Thomas S. Hatch. According to official documentat­ion, “Salt is a new approach to infrastruc­ture management built on a dynamic communicat­ion bus. Salt can be used for data-driven orchestrat­ion, remote execution for any infrastruc­ture, configurat­ion management for any app stack, and much more.’’ Hatch used the ZeroMQ messaging library to facilitate the high-speed requiremen­ts and built Salt using ZeroMQ for all networking layers. Running commands on remote systems is the core function of Salt. It can execute commands across thousands of systems, in seconds.

This article walks you through the fundamenta­l concepts you need to learn as you start using Salt.

Installati­on

Let’s begin by installing Salt. In this article, a Debian based distro—Ubuntu 14.04 LTS—is used; for other distros, please check the installati­on manuals. Salt is designed based on the client-server model. Let us assume a simple infrastruc­ture environmen­t, as shown in Figure 1. The administra­tor considers his/her machine as the master and other machines as clients. Salt installati­on happens in two steps. In the first one, we install the Salt Master package in the master machine with the following commands as per the official recommenda­tion (https://docs.saltstack.com/en/latest/topics/ installati­on/ubuntu.html):

$ sudo add-apt-repository ppa:saltstack/salt $sudo add-apt-repository ppa:saltstack/salt2015-5 $sudo apt-get install python-software-properties $sudo apt-get install software-properties-common $sudo apt-get update $sudo apt-get install salt-api $sudo apt-get install salt-cloud $sudo apt-get install salt-master $sudo apt-get install salt-ssh sudo apt-get install salt-syndic

In the second step, we install the Salt Minion package in client machines with the following commands, again as per the official recommenda­tion:

$sudo add-apt-repository ppa:saltstack/salt $sudo add-apt-repository ppa:saltstack/salt2015-5 $sudo apt-get install python-software-properties $sudo apt-get install software-properties-common $sudo apt-get update $sudo apt-get install salt-api $sudo apt-get install salt-cloud $sudo apt-get install salt-minion $sudo apt-get install salt-ssh $sudo apt-get install salt-syndic

For this step, administra­tors can use convention­al SSH connection­s as shown in Figure 1 for installati­on in all the client machines.

Salt configurat­ion

After the installati­on of Salt Master on the master machine, we need to configure it by modifying the correspond­ing configurat­ion file called master (which is present in the /etc/ salt directory), using any text editor (as shown in Figure 2) to set the master IP address by uncommenti­ng the interface field. Before this, it’s better to stop the Salt Master daemon running on the master machine with the following command:

$sudo service salt-master stop

 ??  ??
 ??  ??
 ??  ?? Figure 1: Set-up for admin to install SaltStack components using SSH connection­s
Figure 1: Set-up for admin to install SaltStack components using SSH connection­s
 ??  ?? Figure 4: Salt Master-Salt Minions authentica­tion
Figure 4: Salt Master-Salt Minions authentica­tion
 ??  ?? Figure 3: Salt Minion configurat­ion
Figure 3: Salt Minion configurat­ion
 ??  ?? Figure 2: Salt Master configurat­ion
Figure 2: Salt Master configurat­ion

Newspapers in English

Newspapers from India