Saltstack For DevOps
Saltstack For DevOps
Extremely fast and simple IT automation and configuration management
About the Book
Every book has a story, this story has a book
I wanted to resign from my job, my suggestions about working on creating a centralized configuration system have not been considered by the team leader. Worse than that, it was not something he really understood. Even my colleagues at that time didn't understand what is a configuration management system. At that time, "DevOps" wasn't a buzz word and folks in software engineering were not conscious about the power of what was coming next.
Like many of us, I'm lazy when it comes to repeating tasks manually but passionate when I automate them. Automation = Power.
I love automation, and in that previous job, there are hundreds of configuration files and thousands of variables to copy from text files then to adjust in some platforms, a huge number of poorly-configured servers, and hundreds of servers to manage by a very small team.. I wanted to work on the automation of some weekly procedures. I was aware that this is a good solution, but it was not the priority neither for the manager nor for the client. I'm talking about a role within a team of 14 people working on the integration of several heavy applications (mainly Java/Oracle, PHP/Mysql, Nginx, Python/Jython) with a complex architecture, tens of versions/environments to manage, and a critical infrastructure covering all the European continent. You can imagine how the word "change" can be seen as a horror movie for team leaders and decision-makers.
In the beginning, I was obliged to follow my boss's guidelines and the work methods my team has adopted, which have one goal: satisfying as fast as possible the unceasing demands of the client.
No, but .. wait, this is not satisfying for me!
I spent almost two weeks searching and working on some solutions before I convinced my boss to give me the time to set up an application prototype that will ease the heavy load, accelerate daily procedures and reduce human errors.
First, I created a configuration management tool using Python/Sqlite3, I spent weeks developing it and it was funny. Some weeks later, I discovered that a tool called Salt exists and found it then a good solution to replace my homemade platform. It meets the expectations of the integration process, or rather, the continuous integration, deployments, and automatic tests.
I hesitated between several alternatives: Ansible, Puppet, CFEngine, Chef .. etc. The choice was made based on several criteria (I was looking for robust, fast configuration management and remote execution tool that everybody can use without learning a new programming language) .. I have never regretted my choice. I found some difficulties. Let me admit: **many** difficulties. And honestly, when I started learning Salt, the official documentation was not as complete and good as now. I even still think the actual documentation can be better.
This book is the fruit of long hours of work and self-learning.
Well, in the beginning, I wanted to resign from my job, just a few days after discovering Salt, I was in love with it, and with what I was doing and learning. I tried Salt the first time when I saw my team taking more than 3 days (sometimes more) to configure hosted platforms at each deployment (we had more than 10 environments per application). After setting it up, the same procedure was taking less than 1/2 hour.
Through this book, it's your turn to discover SaltStack, and I will be your guide.
What are you going to learn?
You will learn how to:
- How to install and configure Salt
- How remote execution works in Salt
- How to describe your infrastructure and apps deployments using code
- How to create an event-based reactive infrastructure
- How to make automated changes to your data center following conditions you describe
- How to orchestrate your data center and app releases
- What are the best practices
- How to scale Salt when your infrastructure grows
- How to troubleshoot Salt
All examples in this book are tested.
The book comes with a free Salt Cheat Sheet.
Bundles that include this book
Very easy to understand
I'd like to tell you that you're doing an excellent job with this book.I've read all your posts related with Salt and all of them are very easy to understand for people that are beginners with these tools.
Nice work !
A good way to learn SaltStack
.. I haven't found enough resources online to learn Salt, but this book was a good way for me to learn many things ..
For non english speakers
I don't have a good english, but I was able to learn Salt
A great book on SaltStack.
Great book on Salt!!!
Table of Contents
- Every book has a story, this story has a book
- To whom is this book addressed?
- How to properly enjoy this guide
- About The Author
Overview and requirements
- SaltStack VS. Puppet VS. Chef VS. Ansible
Installation and configuration
- How Salt versioning works
- Supported OSs
- Installing Salt
- Ubuntu Focal (20)
- Redhat / CentOS 8 PY3
- Understanding the communication model
- Post installation configurations
- Salt master and minion identities
- Salt modules
- Salt execution modules
- Asynchronous execution
- Creating your custom modules
- Salt state modules.
- Salt execution modules vs. Salt state modules
- Asynchronous execution
- Outputter modules
- Salt Command Anatomy
- Runner modules
- Creating your own runner modules
- What are grains?
- Listing grains
- Creating custom grains
- Automating custom grains creation
- Targeting is crucial
- Shell-style Globbing
- List matching
- Targeting with regex
- Targeting with grains
- Targeting with pillar
- Targeting by IP/subnet
- Compound Matchers
- Salt states: SLS
- Organizing SLS
- Extending Salt States
- Salt requisite system
- Putting everything together
- Statement of the Problem
- What are Salt renderers
- Using Jinja in YAML (and making your Salt states cross-platform)
- Updating your infrastructure states based on conditions
- Creating a system configuration dashboard using states, jinja, and grains
- Creating a reactive state
- States Execution and Output Formatter
- The problem and the solution
- What is a top file and when to use it
- Targeting using the top file
- Pillar vs. grains
- Listing pillar data
- Creating pillar data
- Pillar: advanced use cases
The Salt Mine
- When do we need Salt mine
- Hands-On Lab: Using Salt Mine
- Salt mine in practice
- What are formulas
- How to use formulas from a remote gitfs
- How formulas are organized
- How to use formulas locally (recommended)
- Installation and requirements
- The roster file
- Using keys
- Configuring CLI options with Saltfile
- Using salt-ssh
- What is a masterless Salt?
- When to use masterless Salt?
- Installing and configuring a Salt master on the minion or what we call "salting the Salt master"
- Using salt-call commands on a system without a master
- Running states entirely from files local to the minion
- Bootstrapping the minion
- Running masterless States
- Scheduling jobs using states
- Scheduling jobs using modules
- Hands-on lab: Monitoring a web page speed using a scheduled job
- Advanced job scheduling
- Scheduling states
- The Salt event system
- Salt Event bus
- Event types
- Firing events
- Salt states events
- What is Salt reactor?
- Associating events to reactors SLS files
- Working with reactors and reactor types
- What are Salt beacons?
- Watching files with beacons
- Watching memory and CPU with beacons
- Alerting on Slack using beacons and reactors
- What is orchestration and why do we need it?
- Our first orchestration state
- A deeper dive into orchestration
- Applying an orchestration and a high state
Strategies for Scaling the Infrastructure
- Using Salt At Scale
- Too many minions authing at once
- Too many minions re-authing at once
- Too many minions re-connecting at once
- Too many minions returning at once
- Too few resources
- Masterless Salt
- Salt Syndic
- Using Salt At Scale
- General Troubleshooting and Prerequisites Checklist
- Troubleshooting salt-master
- Troubleshooting salt-minion
- Troubleshooting Ports
- Using salt-call
- Useful Commands
- Using includes and extends in Salt states
- Following SLS namespace guidelines
- Organizing Grains
- Using the Documentation
- Follow the official conventions to write formulas
- Start your cheat sheet
- The usual lecture from the local system administrator
Salt Cheat Sheet
Code in this book
Other books by this author
The Leanpub 60-day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms
80% Royalties. Earn $16 on a $20 book.
We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $12 million USDwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them