Ensuring list input forloop: usingqueryrather thanlookup
Theloopkeyword requires a list as input, but thelookupkeyword returns a string of comma-separated values by default. Ansible 2.5 introduced a new Jinja2 function namedquerythat always returns a list, offering a simpler interface and more predictable output from lookup plugins when using theloopkeyword.
You can forcelookupto return a list toloopby usingwantlist=True, or you can usequeryinstead.
The following two examples do the same thing.