Chapter 2. Automating Simple Tasks

As we have mentioned in the previous chapter, Ansible can be used for both, creating and managing a whole infrastructure, as well as be integrated into an infrastructure that is already working.

In this chapter, we will see:

  • What a playbook is and how it works
  • How to create a web server using Ansible
  • A close look at the Jinja2 template engine

But first we will talk about YAML Ain't Markup Language (YAML), a human-readable data serialization language that is widely used in Ansible.

YAML

YAML, like many other data serialization languages (such as JSON), has very few, basic concepts:

  • Declarations
  • Lists
  • Associative arrays

A declaration is very similar to a variable in any other language, that is:

name: 'This is the name' 

To ...

Get Learning Ansible 2 - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.