Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning SaltStack

You're reading from   Learning SaltStack Build, manage, and secure your infrastructure with the power of SaltStack

Arrow left icon
Product type Paperback
Published in Jun 2016
Publisher Packt
ISBN-13 9781785881909
Length 202 pages
Edition 2nd Edition
Concepts
Arrow right icon
Author (1):
Arrow left icon
Colton Myers Colton Myers
Author Profile Icon Colton Myers
Colton Myers
Arrow right icon
View More author details
Toc

Reacting to events


Now that you've learned how to fire our own custom events, it's time to learn how to react to those events. To accomplish this, we will use a tool, fittingly named the reactor.

The reactor is configured in two parts. The first piece is in the master configuration file and defines which events will trigger which reactor files. The second part consists of the reactor files themselves, which define the actions to be taken when reacting to events, and which are similar to the state files.

Here are the lines we will be adding to our master configuration file (/etc/salt/master):

reactor:
  - 'salt/custom/*':
    - salt://reactor.sls

Note that globbing is used to target multiple events with a single configuration. Thus, we are now set up so that when the master receives any event that has a tag that starts with salt/custom/, the master will execute the reactor.sls reactor file from our Salt files in /srv/salt.

Note

If multiple event matchers are defined, Salt will check them in order...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime