• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Sunday, May 25, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Linux

Getting Started With SaltStack on Ubuntu 17.04

How VPS by How VPS
January 1, 2020
in Linux
0
0
SHARES
14
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Requirements
  2. Terminology
    1. Master
    2. Minion
    3. Formula
    4. Pillar
  3. Server setup
    1. Master
    2. Minion
  4. SaltStack master operations
    1. Showing all minions
    2. Accepting an unaccepted minion
    3. Accepting all unaccepted minions
    4. Removing a minion
  5. Creating your first formula
  6. Running your first formula
  7. Conclusion
  8. Want to contribute?


SaltStack is a python-based configuration management program which is optimized for the automation of configuration files, deployments and anything else under the software-defined datacenter topic. In this guide, you will learn how to get started with SaltStack, adding your first nodes and writing your first formula.

Requirements

  • Vultr instance running Ubuntu 17.04 ( master )
  • Vultr instance running Ubuntu 17.04 ( minion )

Terminology

SaltStack uses a few keywords which represent a particular device or configuration, as explained below:

Master

This is the master instance which connects to all servers added to your SaltStack “cluster”, thus also running any commands / communication to your servers.

Minion

The servers which are added to your SaltStack are called minions. Any actions are either performed on one, a group, or all of your minions.

Formula

A formula represents a file or a set of files which introduces the minions which commands that should be performed. This can be the installation of a single application such as nginx or rolling out configuration files, etc.

Pillar

A pillar is a file which stores information related to a group of minions or a single minion. As an example, you would use this sort of file for storing the “Virtual-Hosts” for Nginx for a particular minion.

Server setup

Master

First, we will start with setting up the master for our SaltStack cluster:

apt-get update
apt-get dist-upgrade
apt-get install salt-master

By default, the SaltStack master is not listening on any interfaces, as the master is usually communicating with the minions over the public internet though. We have to make a little change in the configuration file which can be found at /etc/salt/master:

# The address of the interface to bind to:
interface: 0.0.0.0

After the changes have been written to the file, restart the master service:

service salt-master restart

Minion

We can now proceed with adding our first minion. Go straight ahead and install the required packages:

apt-get update
apt-get dist-upgrade
apt-get install salt-minion

Next, we need to make another little change in the minion’s SaltStack configuration which can be found at /etc/salt/minion:

# Set the location of the salt master server. If the master server cannot be
# resolved, then the minion will fail to start.
master: <master_server_ip>

Replace <master_server_ip> with the IP address of your master server as setup earlier. Ideally, you would set up a DNS record for this though, in order to make changing the master server easier.

Afterwards, we have to restart the minion service for the changes to become active:

service salt-minion restart

SaltStack master operations

We now have a working master and minion set up, so we can directly go ahead and work with a small set of the SaltStack commands on the master.

Showing all minions

# salt-key -L
Accepted Keys:
Denied Keys:
Unaccepted Keys:
Rejected Keys:

Note: We have already told the minion to which master server it should connect. Therefore, if you have followed this guide, you would already see the minion under the Unaccepted Keys: section.

Accepting an unaccepted minion

# salt-key -a <minion_id>

Accepting all unaccepted minions

# salt-key -A

Removing a minion

# salt-key -d <minion_id>

Note: <minion_id> usually represents the UNIX hostname of your minion(s) and is stored in the /etc/salt/minion_id file on the minion(s).

Creating your first formula

After adding our minion to the master, we can continue with writing our first formula. Initially, we have to create the folder that stores our formulas:

mkdir -p /srv/salt/

Create the folder for our first formula:

mkdir -p /srv/salt/nginx

Basically, any instructions for a formula are stored in the init.sls file, for example, /srv/salt/nginx/init.sls. As there is an immense amount of operations that can be performed through a formula, we will write a small formula which installs Nginx:

nginx:
  pkg:
    - installed

Running your first formula

After writing into the init.sls file as explained above, we can go ahead and run it:

salt '*' state.sls nginx

Note: nginx represents the name of the folder we have previously created.

Conclusion

SaltStack is a very good software for automating any sort of configuration files, service deployments, initial server roll-outs and similar. Because of the fact that SaltStack is based on Python, you can easily add your own modules too, if you are fluent with the language. Happy automating!

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
Previous Post

How to Install and Configure Open Source Social Network on Ubuntu 16.04

Next Post

Installing Softaculous on cPanel/DirectAdmin/Plesk

Next Post

Installing Softaculous on cPanel/DirectAdmin/Plesk

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet