Created Mittwoch 05 Februar 2020
A playbook is comprised of hosts, tasks,handlers and variables.
Hosts
Defined in inventories.
Syntax
hosts: <patterns>
pattern: Hosts
Tasks
A job to be done. Mostly executed by an ansible module.
Syntax
tasks:
- name <text>
<module name>:
<Arguments>
...
Handlers
Handlers are called after a block of tasks. The notify statement informs the hadler to act. It's executed once. -> It can get more than on notification.
They er called in order of their definition not their order in notify.
Variables
Can also be defined in playbooks not only in the Inventory (or directories).
Use section vars:.
Examples
- hosts: webservers
vars:
http_port: 80