How to conditionally include other playbooks?

I tried this and it isn’t working as expected:

test.yml

`

playbooks cannot be included conditionally.

Is there an alternative solution to get the behavior I’d like?

-Tristan

I’ve done includes for playbooks based on facts typically OS

  • name: include OS specific tasks
    include: “{{ ansible_os_family|lower }}.yml”

if there was a specifc fact you could use such OS, RAM, CPU, write a custom module to make that fact. I guess at that point why not target machines based on inventory groups.

-tp

That will work with task includes, not play includes.