Home > Servers > Systems Management > White Papers > Dell PowerEdge: Getting Started with Redfish Ansible Modules > What is a playbook?
An Ansible playbook is a blueprint of automation tasks that run with limited or no human involvement. Playbooks are run on a set, group, or classification of hosts, which together make up an Ansible inventory. The following figure shows a basic playbook.
A playbook usually includes the keywords described in the following table:
Keyword | Description |
collections | A keyword that imports any collections. Using this keyword to import the dellemc.openmanage namespace tells the playbook where to look for PowerEdge modules. |
connection | A keyword that is usually set to local because the Ansible server runs the REST calls. |
gather_facts | An optional keyword and one that is not necessary for running Dell modules. Gathering information about the configuration of the local host is unnecessary because the information will not be used in the playbook. Setting this keyword to no reduces runtime slightly, |
hosts | A keyword that Identifies the host on which the playbook is run. Because Dell playbooks use REST APIs, this keyword is usually set to localhost, and the Ansible server runs the REST calls. |
input | A special keyword known as an anchor, which is used to reference multiple values with a single variable referenced by &uni_connection_vars. Figure 6 shows credentials and connection variables short-handed with this technique. Subsequent tasks can refer to the grouped variables using the <<:*uni_connection_vars anchor. |
name | An identifier for the playbook, which ideally gives a good indication of what the playbook is designed to accomplish. Names can be dynamic and include variables, as in the example, so runtime changes according to the values the playbook is run with. |
vars | A keyword that details any variables that the playbook needs to run. This keyword is optional because variables can also be passed in at runtime on the command line. |
vars_files | An optional keyword that details any variable files that provide information for the playbook to run. |
Best Practice: Because the YAML file works like a scripting language, you can use comment lines as often as necessary. These lines are ignored during parsing. Comment lines start with the # symbol, which is followed by some text. Comment lines can be used to explain sections of a playbook to make them more easily understandable to others.