Writing an Apache Salt Formula

30 minutes
  • 2 Learning Objectives

About this Hands-on Lab

One of the core features of Salt is its configuration management system. By writing end-state configurations called states and formulas, we can craft reusable configuration files that we can use to both provision and enforce state across our server fleet. In this lab, we’ll begin our Salt configuration management journey by writing an Apache formula.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create Installation State

Create a Salt state that will install the apache2 package.

Create Configuration State

Create a state that will pull Apache’s configuration under Salt’s enforcement. Ensure the Apache service restarts when changes are made to the configuration.

Additional Resources

You work as a DevOps Engineer for a growing digital publisher. To aid in the creation and management of your infrastructure, you have begun to implement Salt as a configuration management solution. As part of this, you need to write an Apache formula.

Using a masterless Salt minion (so you can easily test your states), create an Apache formula that installs, starts and enables Apache, brings the Apache configuration under Salt's management, and sets the service to restart when any changes to the Salt configuration are made. Include an inits.sls file so all these services are called when the apache formula is run.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?