Learning SaltStack

Book description

Learn how to manage your infrastructure by utilizing the power of SaltStack

In Detail

SaltStack is one of the best infrastructure management platforms available. It provides powerful tools for defining and enforcing the state of your infrastructure in a clear, concise way.

This book will start with the installation and setup of Salt along with your first commands, and will take you through all the tools you'll need to manage your infrastructure. You'll learn how to use SaltStack's remote execution system to run commands across your whole infrastructure in seconds. Then, with SaltStack's configuration management system, you'll be able to define the state of your infrastructure in a reproducible, stable manner. You'll also learn a number of other tools within SaltStack that will allow you to create an adaptive, reactive, and self-healing infrastructure. Finally, by the end of the book, you'll be able to build a reliable, scalable, secure, high-performance infrastructure and fully utilize the power of cloud computing.

What You Will Learn

  • Install Salt on all of your servers

  • Run commands on all or some of your minions instantly from a central managing server

  • Write custom Salt modules to handle your infrastructure's unique needs

  • Define the state of your infrastructure and use Salt to enforce that state

  • Create platform-agnostic state definitions for greater flexibility and power

  • Manage virtual servers on public or private clouds using Salt Cloud

  • Use the event system in Salt to create a reactive and self-healing infrastructure

  • Table of contents

    1. Learning SaltStack
      1. Table of Contents
      2. Learning SaltStack
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Errata
          2. Piracy
          3. Questions
      8. 1. Diving In – Our First Salt Commands
        1. Introducing Salt
        2. Installing Salt
          1. Installation with system packages (Ubuntu)
          2. Installing with Salt-Bootstrap
        3. Configuring Salt
          1. Firewall configuration
          2. Salt minion configuration
          3. Starting the Salt master and Salt minion
          4. Accepting the minion key on the master
        4. A game of ping pong
        5. Masterless Salt
        6. Summary
      9. 2. Controlling Your Minions with Remote Execution
        1. The structure of a remote execution command
          1. Command-line options
          2. Targeting strings
            1. Glob matching
            2. Perl-compatible regular expression matching
            3. List matching
            4. Grain and pillar matching
              1. Grains
              2. Pillars
            5. Compound matching
          3. Remote execution modules and functions
            1. Adding users
            2. Installing packages
            3. Managing services
            4. Monitoring minion states
            5. Running arbitrary commands
        2. Summary
      10. 3. Execution Modules – Write Your Own Solution
        1. Exploring the source
          1. Cross-calling execution modules
          2. Grains and the __virtual__ function
          3. The__opts__ and __pillar__ functions
          4. Reformatting return data
        2. An advanced example
        3. Summary
      11. 4. Defining the State of Your Infrastructure
        1. Our first state
        2. The pieces of a state declaration
        3. Expanding to encompass multiple pieces of state
        4. Dependencies using requisites
          1. The require requisite
          2. The watch requisite
          3. Other requisites
          4. The _in requisites
        5. Summary
      12. 5. Expanding Our States with Jinja2 and Pillar
        1. Adding a new minion
        2. Jinja2
          1. apache2 or httpd?
        3. Defining secure minion-specific data in pillar
          1. Using pillar data in states
        4. Summary
      13. 6. The Highstate and Environments
        1. The highstate
          1. Environments
            1. Environments in pillar
          2. Expanding our base environment
        2. Storing our states in Git with GitFS
        3. Summary
      14. 7. Using Salt Cloud to Manage Virtual Minions
        1. Setting up Salt Cloud
          1. Setting up Linode
            1. Creating an API key
          2. Creating a cloud provider configuration
          3. Creating cloud VM profiles
          4. Create and destroy machines
        2. Managing groups of VMs with map files
          1. Creating new masters with map files
        3. Summary
      15. 8. The Reactor and the Event System
        1. The Salt event system
          1. Listening for events
            1. Event structure
          2. Firing events from Salt
          3. Firing events from custom code
        2. Reacting to events
        3. Summary
      16. Index

    Product information

    • Title: Learning SaltStack
    • Author(s): Colton Myers
    • Release date: January 2015
    • Publisher(s): Packt Publishing
    • ISBN: 9781784394608