Book Image

Salt Cookbook

By : Anirban Saha
Book Image

Salt Cookbook

By: Anirban Saha

Overview of this book

Table of Contents (18 chapters)
Salt Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Targeting minions


One of the biggest advantages of Salt is the ability to target minions based on various parameters. This gives us the flexibility to apply states, run commands, and gather information from any combination of minions that we need. In this recipe, you will learn how to target minions using different methods.

How to do it...

Since there are quite a lot of ways to target minions, we will not run the command and view the output for each of them. We will look at the possible ways of targeting minions and the methods to implement them. Each of the following examples show the procedure to target minions from the Salt command and also in the top.sls file. However, examples for top.sls are provided only for matchers that have this feature.

The procedure to target minions on the salt command line is as follows:

  • Name-based matching with shell style globbing:

    [root@salt-master ~]# salt 'devdc1app01' state.sls group
    [root@salt-master ~]# salt '*.salt-cookbook.com' state.sls \ user
    
    '*.salt...