- SaltStack Tutorial
- SaltStack - Home
- SaltStack - Overview
- SaltStack - Architecture
- SaltStack - Competitors
- SaltStack - Installation
- Creating a Simple Environment
- SaltStack - Access Control System
- SaltStack - Job Management
- SaltStack - Salt File Server
- SaltStack - Git as a File Server
- Using MinionFS as the File Server
- SaltStack - Using Cron with Salt
- SaltStack - Remote Execution
- Configuration Management
- SaltStack - Logging
- SaltStack - Salt through SSH
- Salt for Cloud Infrastructure
- SaltStack - Salt Proxy Minions
- SaltStack - Event system
- SaltStack - Orchestration
- SaltStack - Salt Package Manager
- SaltStack - Python API
- SaltStack - Working Example
- SaltStack Useful Resources
- SaltStack - Quick Guide
- SaltStack - Useful Resources
- SaltStack - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
SaltStack - Creating a Simple Environment
In this chapter, we will create a simple SaltStack environment, one salt master and two salt minions. This environment will help us to learn the salt concept in the upcoming chapters.
Let us adhere to the following steps to create the SaltStack environment.
Install the VirtualBox Environment
VirtualBox is a cross-platform virtualization application. VirtualBox allows you to run more than one operating system at a time. VirtualBox runs on Windows, Linux, Macintosh and Solaris. It hosts and supports a large number of Guest Operating Systems.
You can download and install VirtualBox by visiting the following link − https://www.virtualbox.org/wiki/Downloads
We will create three virtual machines and run it using the VirtualBox.
Vagrant provides easy to configure, reproducible and portable work environments.
You can download and install the Vagrant by visiting the following link − https://www.vagrantup.com
After the successful installation of Vagrant, you need to configure it. Create a single file named as Vagrantfile in a folder and describe the type of machine and its properties.
Run Vagrant − To run the Vagrant, issue the following command −
After you run vagrant up, Vagrant creates and starts those machines, which are defined in the Vagrantfile using the VirtualBox in the background. These machines will be running until you close them.
Stop Vagrant − To stop all the running machines in the VirtualBox, type the following command −
Download the Demo Environment
SaltStack provides a simple demo environment as Vagrant setup and it is hosted in the github. Let us download the setup using the following command −
cd /cd/to/path git clone https://github.com/UtahDave/salt-vagrant-demo
Now, start the demo environment using the following command −
cd /cd/to/path/salt-vagrant-demo vagrant up
After this command, you will see the following response −
Now, three servers are running, one with the salt master configured and two with the salt minion configured.
Run Salt master
Login to the Salt master using the following command −
vagrant ssh master
Now, move to the root user using the command below −
Now we have successfully connected to the Salt master.
Let us now go through some of the basic commands in SaltStack.
List out all the Keys
The following command is to verify the Salt minion connections and view whether the connection is accepted, rejected or pending.
It will produce the following output −
Accepted Keys: minion1 minion2 Denied Keys: Unaccepted Keys: Rejected Keys:
Verify Salt Minions
Now, we have accepted all the keys, you can send a command from Salt master to check whether Salt minions are listening or not,
salt '*' test.ping
It will produce the following output −
minion1: True minion2: True
From the above result, list out minion 1 and minion 2, which means minions are listening properly, otherwise minions might now respond properly.