Preface

Who Should Read This Book

Do you want to automate your infrastructure? What about managing your configuration files? Do you use Python? Salt provides a system to manage simple and complex infrastructures. This book will give you an introduction if you have never used Salt, touching on the major pieces and giving you enough information to feel comfortable in deploying Salt in a major production infrastructure.

Whether you are a sysadmin responsible for the installation and maintenance of the operating system or you are a devops engineer at a startup responsible for getting your code to hundred of systems, Salt is a tool to make your job easier. Salt is used by small and large companies to manage tasks ranging from maintaining the basic operating system parameters and configuration all the way to deploying and configuring custom applications.

Many of the examples in this book assume that you have some basic familiarity with Python and YAML. But knowledge of these technologies is not an absolute requirement. If you have some programming experience and some experience with basic data formats (e.g., JSON or XML), then you should be able to follow along without much trouble. At an even more basic level, you should have some working knowledge of Linux and a basic filesystem layout.

Salt can help you solve a wide variety of problems. One of its best features is that, as with Python, much of Salt’s internals are exposed to you. This book only gives a glimpse into the possibilities of working with Salt, but it will provide you with a basic understanding from which you can dive into more of the details independently.

Why We Wrote This Book

When I (Craig) first started learning Salt, I was overwhelmed by its features, terms, and even some of the concepts. The more I worked with it and the more I learned, the more I wanted to use Salt to solve even more problems. As Salt spread in my company, I saw my coworkers struggle the same way I did. The documentation on the SaltStack website is great, but it wasn’t sufficient. I wrote this book because I wanted others to be able to jump right in with a solid understanding of the basics.

What This Book Is Not

Salt is a great tool for solving a large and various set of problems. Salt grows more and more every day. Mew features are added, existing features are improved, and unnecessary or outdated code is removed. I wanted to give a firm base from which you could learn more and more about Salt. But, covering everything Salt can do is well beyond the scope of a single book. Our goal is to cover the basics, the essentials of Salt. This book will give you a solid platform to build upon. The topics in this book are generally considered to be the most heavily used features of Salt. But the coverage is far from complete. This is a great place to start, but not the only place to learn about Salt.

Once you have the basics down, the documentation on the SaltStack website is a great place to learn more, including details on plenty of advanced features that are, unfortunately, beyond the scope of this book.

A Word on Salt Today

Salt has a very large and heavily engaged user base. It is one of the most contributed projects on GitHub. SaltStack is the company behind Salt. It offers services and training for Salt itself, and is fully committed to Salt being open core. There is an active mailing list, a very chatty IRC channel, and plenty of discussions and pull requests on GitHub. As of this writing, version 2015.2.0 (codenamed Lithium) was released.

Navigating This Book

This book is organized roughly as follows:

  • Chapter 1 introduces the basic organization of Salt.

  • Chapter 2 gives a quick summary of the basic command-line utilities.

  • Chapters 3 and 4 introduce you to two of the fundamental pieces of Salt: the remote execution engine and the state system.

  • Chapter 5 guides you through the basic data elements at the core of Salt.

  • Chapters 6 and 8 describe how you can extend and customize Salt.

  • Chapters 7 and 9 give more information on the main control point (the Salt master) and some various ways you can structure Salt.

  • The final chapter, Chapter 10, gives a very simple introduction to using Salt in a cloud infrastructure.

If you have used Salt even a little, you can likely skip Chapters 1 through 3 and give 4 a quick skim. If you are only interested in customizing the core of Salt, then Chapters 6 and 8 would be of the most interest. However, it is important to note that the examples do build on one another. So, using the examples in, say, Chapter 4, does depend on you having gone through the examples in Chapters 2 and 3. The companion code should be able to fill in the gaps.

Online Resources

The Salt documentation is very thorough and a fantastic reference. The documentation pages will link to all of the resources you need to learn even more about Salt and the various technologies used.

Conventions Used in This Book

The following typographical conventions are used in this book:

Italic

Indicates new terms, URLs, email addresses, filenames, and file extensions.

Constant width

Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.

Constant width bold

Shows commands or other text that should be typed literally by the user.

Constant width italic

Shows text that should be replaced with user-supplied values or by values determined by context.

Tip

This icon signifies a tip or suggestion.

Note

This element signifies a general note.

Warning

This icon indicates a warning or caution.

Using Code Examples

Supplemental material (code examples, exercises, etc.) is available for download at https://github.com/craig5/salt-essentials-utils.

This book is here to help you get your job done. In general, if example code is offered with this book, you may use it in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Salt Essentials by Craig Sebenik and Thomas Hatch (O’Reilly). Copyright 2015 Craig Sebenik and Thomas Hatch, 978-1-491-90063-5.”

If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at .

Safari® Books Online

Note

Safari Books Online is an on-demand digital library that delivers expert content in both book and video form from the world’s leading authors in technology and business.

Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training.

Safari Books Online offers a range of plans and pricing for enterprise, government, education, and individuals.

Members have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like O’Reilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and hundreds more. For more information about Safari Books Online, please visit us online.

How to Contact Us

Please address comments and questions concerning this book to the publisher:

  • O’Reilly Media, Inc.
  • 1005 Gravenstein Highway North
  • Sebastopol, CA 95472
  • 800-998-9938 (in the United States or Canada)
  • 707-829-0515 (international or local)
  • 707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at http://bit.ly/salt_essentials.

To comment or ask technical questions about this book, send email to .

For more information about our books, courses, conferences, and news, see our website at http://www.oreilly.com.

Find us on Facebook: http://facebook.com/oreilly

Follow us on Twitter: http://twitter.com/oreillymedia

Watch us on YouTube: http://www.youtube.com/oreillymedia

Acknowledgments

This book would not have been possible without the support and encouragement of our friends and family. There are plenty of people who gave small hints and suggestions, but the book would not have been what it is without the help of David Boucha and Seth House from SaltStack. A big thank you goes to Ryan Lane and Seth House (again) for their review of the book; they found a number of pretty ugly mistakes. They also gave plenty of fantastic tips and some great advice on how many parts could be improved. We are indebted to them for their help.

Get Salt Essentials 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.