Book Image

Hands-On Enterprise Automation on Linux

By : James Freeman
Book Image

Hands-On Enterprise Automation on Linux

By: James Freeman

Overview of this book

Automation is paramount if you want to run Linux in your enterprise effectively. It helps you minimize costs by reducing manual operations, ensuring compliance across data centers, and accelerating deployments for your cloud infrastructures. Complete with detailed explanations, practical examples, and self-assessment questions, this book will teach you how to manage your Linux estate and leverage Ansible to achieve effective levels of automation. You'll learn important concepts on standard operating environments that lend themselves to automation, and then build on this knowledge by applying Ansible to achieve standardization throughout your Linux environments. By the end of this Linux automation book, you'll be able to build, deploy, and manage an entire estate of Linux servers with higher reliability and lower overheads than ever before.
Table of Contents (23 chapters)
1
Section 1: Core Concepts
5
Section 2: Standardizing Your Linux Servers
10
Section 3: Day-to-Day Management
16
Section 4: Securing Your Linux Servers

Understanding Ansible templates

A common automation requirement is to set a value in a configuration file, or even to deploy a new configuration file, based on some given parameters. Ansible provides modules that can perform similar functions to the venerable sed and awk utilities, and of course, these are valid ways to modify an existing configuration file. Let's suppose we have a small Apache virtual host configuration file, containing the following code:

<VirtualHost *:80>
DocumentRoot "/var/www/automation"
ServerName www.example.com
</VirtualHost>

We want to deploy this configuration, but customize the DocumentRoot parameter for each host. Naturally, we could just deploy the preceding file, exactly as it is, to every host, and then use a regular expression, in conjunction with the Ansible replace module, to find the DocumentRoot line and modify...