Using reactors with Salt Cloud

Salt Cloud is powerful on its own, but it can be made even more powerful by tying it in Salt's own event bus. Let's go ahead and set up a workflow to kick off whenever a new server is spun up using Salt Cloud. The steps that we need to perform, in order, are as follows:

  1. Request a new cloud server.
  2. Upon its creation, kick off a test suite to validate the servers.
  3. If the tests fail, fire an alert and stop.
  4. If they succeed, add the server to the load balancer.

We won't create a full test suite here as that is well beyond the scope of this book. However, because we can make use of Jinja templates, we will go ahead and perform some configuration for the load balancer.

Setting up the event tags

We're going to use a combination ...

Get Mastering SaltStack - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.