Ansible Playbook Structure
Following is a sample playbook file to show the possible components:
The first line is the name of ansible play contained int he playbook. The second line lists the hosts that the play is run against. This must match one or more entries in the inventory file. It can be individual servers or a group.
The become line defines whether or not we will become root (i.e. sudo) during the play.
The vars section is where we can define variables to be used throughout the playbook to make it more modular.
The tasks section is where the work actually gets done. The playbook can have as many tasks as you want to be part of the play. Within the task, you provide the module you want to execute and then provide required and additional values to implement the task of the module. Ansible modules is where the power exists.