From charlesreid1

Revision as of 19:06, 13 November 2018 by Admin (talk | contribs) (Created page with "==Separating Playbooks by Role== For Ansible playbooks involving multiple roles, top level playbooks should be separated by role. Here is the simplest possible top-level pla...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Separating Playbooks by Role

For Ansible playbooks involving multiple roles, top level playbooks should be separated by role.

Here is the simplest possible top-level playbook, which includes two sub-playbooks:

- import_playbook: webservers.yml
- import_playbook: dbservers.yml

These files are both at the top level, and

Using Separate Playbooks

Now that you have multiple roles split across playbooks, you can either configure your whole infrastructure, by running site.yml with ansible-playbook, or you can configure particular pieces of infrastructure, for example by only running dbservers.yml.

To limit which playbooks are run, either run the whole site-wide playbook with the --limit flag, or run with the sub-playbook:

ansible-playbook site.yml --limit webservers
ansible-playbook webservers.yml

Flags