How do you avoid running same roles multiple times when including playbooks?

Short version:
Why does Ansible keep running ‘-include: mysql-cluster.yml’ whenever it encounters it? Can’t it recognize this was already executed once?

Long version:
I am trying to find a good way to organize Ansible scripts so that they meet these requirements:

  • Developers can run their project and not worry about running any dependencies manually
  • Have a master playbook describing our whole infrastructure (site.yml) and not call dependencies multiple times even though they already run.

We’re running a mid size setup with site.yml that is a list of other playbooks that we include.
`

file: site.yml

This is a top level playbook representing everything in Polaris.

It includes subplaybooks for independent collections of modules that may be deployed together.

Infrastructure

  • include: cdh5.yml
  • include: memcached.yml
  • include: myAPI_1.yml
  • include: myAPI_2.yml

( and so on )

`

The myAPI_1 and myAPI_2 playbook look like this:

`

file: myAPI_1.yml

Use a when: clause, or make the included files tasks idempotent.

So basically I will need to set facts for every major playbook once it succeeds and then check for it?
I thought Ansible was idempotent in this way by default