Dynamically including task files?

I’m trying to dynamically include multiple separated tasks files based on a list - I went straight to using include while iterating on with_items until I saw the deprecation warning.

Before everyone just jumps on me, I do realise that this has been discussed a LOT of times on this list but after reading a bunch of threads I tend to think that my use case is a bit different and is not really achievable by using with_items inside of a task.

Use case:

list.yml
task_files:

  • x
  • y
  • z

playbook.yml

  • hosts: localhost
    vars_files:
    list.yml
    include: {{ item }}
    with_items: task_files

Please note that this is just part of a hack I’m running on my local box and do not intend to use it in production-like environments. Any advice on how to achieve this?

Thanks in advance.

Miguel

At that point i would just dynamically write the playbook, easy to do with an jinja template if you want ansible to do it (I used to do it, but somehow sanity crept in).