Book Image

Mastering SaltStack - Second Edition

Book Image

Mastering SaltStack - Second Edition

Overview of this book

SaltStack is a powerful configuration management and automation suite designed to manage servers and tens of thousands of nodes. This book showcases Salt as a very powerful automation framework. We will review the fundamental concepts to get you in the right frame of mind, and then explore Salt in much greater depth. You will explore Salt SSH as a powerful tool and take Salt Cloud to the next level. Next, you’ll master using Salt services with ease in your infrastructure. You will discover methods and strategies to scale your infrastructure properly. You will also learn how to use Salt as a powerful monitoring tool. By the end of this book, you will have learned troubleshooting tips and best practices to make the entire process of using Salt pain-free and easy.
Table of Contents (20 chapters)
Mastering SaltStack Second Edition
Credits
Foreword
About the Author
About the Reviewer
www.PacktPub.com
Preface

Preface

I'm very excited to have been given the chance to put this book together. I've been given the rare opportunity to watch Salt grow from an idea in the brain of Tom Hatch to an award-winning open source project, and onward to the flagship product of an award-winning open source company. Salt has become an incredibly powerful framework, which I wish I'd had access to years ago.

Every day, I learn something new about Salt. This book is a collection of a number of those things, aimed at the advanced user. Don't see it as the last word on any of the topics that it covers. Instead, see it as a guide on your journey to use this tool to its fullest potential.

As you read through this book, I hope that the ideas and examples in it inspire you to update and innovate your infrastructure.

What this book covers

Chapter 1, Essentials Revisited, takes a step back to a few of the basics inside of Salt. These concepts are critical to understanding many of the concepts discussed in this book, and many of them will be explored further in later chapters.

Chapter 2, Diving into Salt Internals, goes in depth with the management of Salt’s own configuration files, how Salt’s loader system works, before finally discussing the state compiler.

Chapter 3, Managing States, builds upon the state concepts from the previous chapter and goes on to discuss how Salt states can be compiled together to form a more cohesive solution for your organization.

Chapter 4, Exploring Salt SSH, will provide you with a basic understanding of Salt’s SSH transport layer, before jumping into a more technical overview of the underlying components.

Chapter 5, Managing Tasks Asynchronously, explores some of the subsystems in Salt that are designed for handling tasks, which interact with each other to achieve an end goal.

Chapter 6, Taking Advantage of Salt Information Systems, looks at some of the subsystems in Salt that are designed entirely for data management. The functionality of these subsystems can be utilized by the master or minion, and sometimes both.

Chapter 7, Taking Salt Cloud to the Next Level, brings you an understanding of how Salt interacts with public clouds and how you can extend that interaction to achieve a more cohesive infrastructure definition.

Chapter 8, Using Salt with REST, covers using Salt to communicate over HTTP, both as a client and as a server. With these APIs in place, Salt can either be a cog in another system or be the system that manages the cogs.

Chapter 9, Understanding the RAET and TCP Transports, follows a very technical discussion of various transport layers, both inside and outside of Salt. If you are looking to move beyond the ZeroMQ transport, this chapter is for you.

Chapter 10, Strategies for Scaling, explores a number of subsystems designed to allow Salt to manage large-scale data centers. Even if you are managing a small infrastructure now, I would encourage you to take a look at the options available here: they may just help you rethink your existing infrastructure anyway.

Chapter 11, Monitoring with Salt, explores many of the ways that Salt can be used to extend your own monitoring system and even bring its own monitoring tools to the party.

Chapter 12, Exploring Best Practices, helps you know how to most effectively use Salt in a way that will not only lead to easy management for you, but also for those who work with or follow you.

Chapter 13, Troubleshooting Problems, talks about some of the ways that things can go wrong in Salt and what to do when that happens.

What you need for this book

While this book covers a lot of ground, the focus is on Salt. It is recommended that you use the latest version of Salt available to you, though most of the information is also relevant to older versions.

A number of other products and services are mentioned in this book and its examples. While the examples will be useful with those products and services, they are designed to still be generic enough to demonstrate the intended information without requiring the purchase or installation of or subscription to third-party entities.

Any hardware or platform that can support Salt may be used for the examples in this book that pertain to minion operations. The Salt master is not yet supported in a Windows environment, so any master-oriented examples will require a Linux or Unix environment.

Who this book is for

This book is ideal for IT professionals and ops engineers who already manage groups of servers but would like to expand their knowledge and gain expertise with SaltStack. This book explains the advanced features and concepts of Salt. A basic knowledge of Salt is required in order to get to grips with advanced Salt features.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Unix distributions will often use the /usr/local/etc/salt/ directory instead, while Windows uses the C:\salt\ directory ."

A block of code is set as follows:

name: apache
os: RedHat, Debian, Ubuntu, Suse, FreeBSD
os_family: RedHat, Debian, Suse, FreeBSD
version: 201607
release: 1
minimum_version: 2015.8
top_level_dir: apache
summary: Formula for installing Apache
description: Formula for installing the Apache web server
optional: mod_perl
recommended: mod_ssl

Any command-line input or output is written as follows:

# mkdir -p /srv/salt/devenv/

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "On the main screen of the repository, you will see a button titled Clone or download."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.