Minion Configuration

Length: 00:06:07

Lesson Summary:

Much like with our master configuration file, our minion configuration file allows us to configure various options related to our minion and our minions' connection to our master. Located at /etc/salt/minion, the minion config is also a fairly long file whose default settings tend to work out-of-box, with the option to alter almost every part of the minion's default settings. Minion configuration files can also be stored until minion.d using the .conf extension.

The single most important line in the minion configuration file is the master setting; this is where we denote the hostname, IP address, or URL of our master server. By default, it looks for a master using the hostname salt, which is what we used when setting up our environment.

In this lesson, we are going to make one change on each of our minions. Since our minion configuration can also contain grain data -- remember grains are data about the server -- we're going to add a grain for each server denoting its role or roles.

Add Grain Information

On the Master

  1. Move into /etc/salt/minion.d:

     cd /etc/salt/minion.d
    
  2. Create and open a configuration file called grains.conf:

     sudo $EDITOR grains.conf
    

    Again, we want to define roles for our server. In this instance, we're working on the master, so master is the role we're going to assign.

  3. Assign the role:

     grains:
       roles:
         - master
    
  4. Save and exit the file.

  5. Restart the salt-minion service:

     sudo systemctl restart salt-minion
    

On Minion 1

  1. Move into /etc/salt/minion.d:

     cd /etc/salt/minion.d
    
  2. Create and open grains.conf:

     sudo $EDITOR grains.conf
    
  3. Since we know this minion is used in a test -- or dev -- environment, we want to give it the role dev. We also want to assign it the roles webserver and database, since it will be undertaking the roles of both:

     grains:
       roles:
         - dev
         - webserver
         - database
    

    Notice how a grain can have more than one value.

  4. Restart the salt-minion service:

     sudo systemctl restart salt-minion
    

On Minion 2

  1. Move into /etc/salt/minion.d:

     cd /etc/salt/minion.d
    
  2. Create and open grains.conf:

     sudo $EDITOR grains.conf
    
  3. As with our previous minion, we want to give it the dev role. We also want to assign it the roles webserver and database, since it will also be undertaking the roles of both:

     grains:
       roles:
         - dev
         - webserver
         - database
    
  4. Restart the salt-minion service:

     sudo systemctl restart salt-minion
    

This lesson is only available to Linux Academy members.

Sign Up To View This Lesson

Or Log In

Looking For Team Training?

Learn More