Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
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

The Salt event system


Events are an integral part of almost everything Salt does. However, for the most part, these events are designed to be invisible and are designed to work behind the scenes to provide interprocess communication and make a complex system feel simple and friendly to the user.

We can also leverage the event system for our own purposes.

Listening for events

Before you learn about reacting to events or firing our own, let's inspect some of these events that are happening all the time in Salt. A Salt runner function (state.event) is provided for this purpose.

If we run it with no arguments, it will automatically connect to the master event bus and print all events that come through that bus:

# sudo salt-run state.event

Note that if you don't see any events, the easiest way to create events is by running a job (such as test.ping) from your master.

Here is the job I ran in one terminal window while state.event was running in another:

# sudo salt '*' test.ping
myminion:
    True...
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