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

Configuring nodegroups


A feature that makes Salt very efficient is its ability to configure nodegroups. They are groups of hosts that we can configure based on various system properties and use the group name to target minions. In this recipe, you will learn how to configure nodegroups.

How to do it...

  1. Edit the /etc/salt/master file on the Salt master and uncomment the key nodegroups. Edit the lines following the nodegroups key so that the entire nodegroups configuration looks as follows:

    nodegroups:
      stgdb: 'G@environment:staging and G@server_type:db'
      dc1devapp: 'G@location:dc1 and G@environment:development and G@server_type:app'
      prodmon: 'L@prddc1mon01,prddc2mon03,prddc3mon10'
  2. Restart the salt-master daemon for the changes to take place.

How it works...

In this recipe, we demonstrated how to configure nodegroups in various ways.

The nodegroups key in the master configuration file needs to be uncommented and all entries under it are identified as configured nodegroups.

The first line is configured...