Ansible Playbooks
Introduction
Playbooks Overview
- Playbooks are the main construct within Ansible.
- Playbooks have a list of Plays.
- Plays map hosts to tasks. Tasks are basically calls to Ansible modules.
- Playbooks structure looks like:
- Playbooks contain Plays.
- Plays contain Tasks
- Tasks call Modules.
- The most basic formal of a playbook is as follows:
---
- hosts:
vars:
remote_user:
tasks:
- name:
- name:
handlers:
- host defines which hosts/groups this playbooks should be applied to. This is a list so multiple can be entered separated by colons.
- vars
- remote_user defines the users name for accessing the hosts. Remote_user can be used under tasks as well.
- tasks
- name is the name of the task, could be anything, as long as it is descriptive.
- handlers