Saltstack is a management tool helping to configure your systems to make it easier to administrate.


Salt is a tool that can limitlessly administrate as much servers as possible in only a few lines of command.
It will allow you to install packages in one command, manage different vhost, handle your users,… from only one server.

By using Salt, we use a minima 2 servers including one of them as the master (Parent) and the other as the minion (Child).
The installation is performed on the system via the following commands :

The minion knows the master by his hostname or IP address in order to intercept these requests.
The master knows the minion by his hostname.
The minions can also be identified by criterias (operating system, regexp, …).

Master’s IP address.

1st minion’s IP address.


First we configure the minion with the master’s IP address then we restart the service :

Then, we configure the master’s interface with the master’s IP address and we un-comment the configuration file_roots :

We restart the service on different servers :

Communication between master and minion is operating based on md5 key.
So, we list keys to identify our minion and confirm its key :

Confirm all keys without specifying the hostname_minion.


Salt is now operational and we can begin using it via __salt_ command :

Useful commands

Salt has commandes suitable for a main part of actions that you are going to do on your different servers.
The advantage is to be able to execute our actions on all your minion servers at the same time.
Here is a non-exhaustive list of useful commands :

States files

Salt is a true operator of configuration as soon as we begin to set states files used to become minion servers’ print.
These files located in the folder /srv/salt/ are in YAML format.

For instance, let’s imagine a system with minion servers in which we want to install Apache then start the service :

State ID.

Declaration of the pkg plug-in.

Function installed of the pkg plug-in (replaceable by pkg.installed).

Declaration of the service plug-in.

Function running of the service plug-in.

We are testing our commands so that minion servers can interpret it :

The test shows that Apache is neither installed nor operational and we can relaunch the command withut running test :

Here is another example to replace the nano package by __vim___ :

Now, we are going to combine both our states apache and vim :

Finally, we could have proceeded with a global update of our minions configuration.
So we edit the principal file top.sls located in the __pillars_ folder :

This configuration will execute the state apache for all minions and the state vim for all minions whose hostname or ID begin with minionew.
The function state.highstate allows reading all states to apply in /srv/salt/top.sls :

Categories: DevOpsTutorials

JN Community

Les Ressources, en particulier les tutoriaux, présupposent que l’Utilisateur qui décide de les mettre en œuvre dispose des connaissances, des compétences et de l’expérience nécessaire pour cette mise en œuvre. L’Utilisateur disposant d’une connaissance, compétence et/ou expérience limitée ou insuffisante doit absolument s’abstenir de mettre en œuvre les Ressources par lui-même. Jaguar Network décline toute responsabilité quant aux conséquences dommageables de la mise en œuvre des Ressources, notamment sur les infrastructures informatiques de l’Utilisateur, de ses commettants ou préposés ou de tout tiers. Il est précisé en tant que de besoin que toute intervention de Jaguar Network visant à réparer les dommages causés par la mise en œuvre des Ressources par un Utilisateur ne disposant pas des connaissances, compétences et/ou expériences suffisantes sera facturée et fera l’objet d’un devis préalable et d’un bon de commande aux conditions des contrats Jaguar Network en vigueur.

Related Posts


Installation of a web server LEMP (Linux, Nginx, MySQL, PHP)

Vote The installation of a server LEMP Linux + Nginx + MySQL + PHP might be more useful and efficient than an Apache (server LAMP). Articles similaires


Operating load-balancing with HAproxy

Vote HAproxy is a software allowing Load-Balancing between several web servers by allocating requests in an almost transparent way for the user. Articles similaires


10 tips to write efficient scripts on Linux

Vote The shell script is the most simple type of programming you would write on Linux. Moreover, it is a necessary skill to automate your system administration tasks, to develop new simple features, … In Read more…