From charlesreid1

This page covers Ansible tasks in greater detail.

Basics

Tasks can be organized for playbooks in various ways.

The easiest and simplest way is to place all tasks (along with all other playbook information) into a single YAML file in the top level playbooks directory.

playbooks/
        hosts
        site.yml

An alternative way that gives finer grained control is to include a tasks directory in the top level playbooks directory, and either use a single task file that contains all tasks, or split tasks into different YAML files:

playbooks/
        hosts
        site.yml
        tasks/
            main.yml
            foo.yml
            bar.yml


Flags