Linux Academy has long offered looks into configuration management and remote execution tools, and we’re happy to announce that we’ve added Salt (SaltStack) to our roster of available DevOps courses. In Using Salt for Configuration Management and Orchestration, we take a look at the highly-modular, very-extensible open source platform Salt, and learn how to use Salt to perform everyday systems administration and infrastructure tasks.
Throughout the course, we’ll work towards a single “end state” configuration, wherein we learn Salt concepts by building out a LAMP stack using Salt remote execution tasks, states, and formulas, then use Salt to deploy a WordPress blog on top of the stack we just built. As we work through each part of our desired end state, we’ll cover the following topics:
In Salt Concepts, we learn about the common terminology used when working with Salt, as well as overviews of multiple Salt components. We’ll also learn how to use YAML, a core building block to using Salt. By default, YAML is used in our configuration files, states, and more. This short section aims to provide students with the tools they need to begin working with Salt almost out of the gate.
Installing and Configuring Salt
Here we begin to work hands-on with Salt by building up the environment we use throughout the rest of the course. We learn to create a Salt Master server on Ubuntu 16.04, then two minions of different distros in which we can perform out tasks. Our Ubuntu 16.04 minion will work as our web server, while our CentOS 7 minion will function as the database. We also learn how to set up a masterless minion for testing purposes, and how to secure our Salt install through the use of key management and the
salt-key tooling. When finished, we will have a functional and secure Salt environment in which we can work with for the rest of the course.
The next step we take in our Salt journey is working with execution modules, which let us run commands and perform tasks across multiple servers. In this formative section, we learn how to target which of the servers in our fleet we want to work with, view documentation and module information without leaving the command line, and gain experience using some of the more commonly used execution modules.
Salt States and Formulas
Here we begin the real meat of the course and start to prepare our end-state formulas that will configure our LAMP stack. We state by creating a PHP formula, then create the beginning of our Apache setup. While doing this, we learn the anatomy of a Salt state, how to create relationships between states, and how to manage files from the master. This also prepares us for our next section.
Taking our very basic Apache formula, this section guides up through our first lines of Jinja, Salt’s templating engine, as we learn how to make a state work across multiple distributions and import values from other files; additionally, we learn to take these concepts and use them in a templated configuration file.
Pillar allows users to store user-defined variables that can be assigned to minions, most often based on the minion’s purpose. By working on our MySQL formula, we first learn how to set our pillar data, as well as how to configure our pillar directory; then we explore the various ways we can call pillar data in our states. We also make use of the GPG renderer to enhance the security of our pillar data.
Putting It All Together
Finally, this last section looks at the creation of a Salt formula from beginning to end, with respect to all the concepts we just learned. Here, we create our WordPress formula, completing our end state by first reviewing what states we’ll need to create before we begin to fill out our pillar data, variables map, and the states themselves. When done, we’ll have a functioning WordPress formula we can use to achieve our end state!
So, if Salt has peaked your interest before —or even if this is the first time— join me in exploring the above concepts as we build out our WordPress end state using Salt. Let’s get started!