ansible with_items list of lists is flattening

Question:

I’m trying to use ansible to loop over a list of lists to install some packages. But {{item}} is returning every element in the sub lists rather than the sublist itself. I have a yaml file which come from a manifest list from outside ansible and it looks like this:

My task looks like this:

When I run that I get:

When I try:

it prints every element (module, version, extra, and so on), not just the sublist (which is what I would expect)

Answer:

Unfortunately, this is the intended behavior. Please see this discussion on with_tems and nested lists

Leave a Reply