InterviewSolution
Saved Bookmarks
| 1. |
Difference between play and playbook? |
|
Answer» Ansible play is a set of tasks that are run on ONE or more managed hosts. A play may INCLUDE one or more tasks, and the most common way to execute play is to use a playbook. Play always starts with the top DIRECTORY, which means it will start from the “- hosts” line always. Ansible playbook contains one or more plays to have the feasibility of running MULTIPLE tasks on a different set of hosts. Below is the example of a play: - hosts: webservers tasks: - name: ensure apache is at the LATEST version yum: name: httpd state: latestBelow is the example of a playbook: --- - hosts: webservers tasks: - name: ensure apache is at the latest version yum: name: httpd state: latest - hosts: databases tasks: - name: ensure postgresql is at the latest version yum: name: postgresql state: latest |
|