Using with_fileglob with include statement

Hi,

My goal is to include all playbooks from a certain directory. Those playbooks will be generated dynamically, so I wanted to avoid specifying exact names of each playbook.

I tried:

`

  • include: “{{ item }}”
    with_fileglob:
  • gen_playbooks/*.yml
    when: # some condition
    `

But I’ve got:

ERROR: file could not read: /mnt/ansible/{{ item }}

Looks like {{ item }} is not being evaulated in this context.

Is there any other way to do what I want to achieve?

Best Regards,
Karol

er .. no, but this will work:

ansible-playbook gen_playbooks/*.yml