Introduction to Ansible playbooks
Ansible playbooks are a collection of Ansible tasks to produce the desired configuration within target managed nodes. They have the following features:
- They help in managing configuration within multiple remote servers using declarative steps.
- They use a sequential list of idempotent steps and steps that match the expected configuration are not applied again.
- The tasks within the playbook can be synchronous and asynchronous.
- They enable GitOps by allowing the steps to be stored using a simple YAML file to keep in source control, providing configuration management as code (CaC).
Ansible playbooks consist of multiple plays, and each play is mapped to a group of hosts using a role and consists of a series of tasks required to achieve them, something like the following diagram:
The following is an example of a simple playbook that pings all servers.
Create a file called...