Use included circles and expressions in 'with_items' and 'when' statement

Hi!

I have a problem with with_items+when statement, please help me. In Jinja2 syntax it’s like this:

`

  • debug: msg=“{% for item in vfiles%}{% for bin in item.binaries %}{% if
    bin.name+‘.’+bin.ext in files.stdout_lines %}{{item.container}}{% endif
    %}{% endfor %}{% endfor %}”

`

P.S. Sorry for my english.

Now i use

`

  • set_fact: tmpvar=“{% for item in vfiles%}{% for bin in item.binaries %}{% if bin.name+‘.’+bin.ext in files.stdout_lines %}{{item.container}} {% endif %}{% endfor %}{% endfor %}”

  • debug: var=item
    with_items:

  • “{{tmpvar.split()}}”

`

Maybe there is an better way?

Generally ansible frowns upon usages that are too “code-like” and tries to find some other ways to solve them that are easier to read.

Can we talk about your underlying use case that you are trying to model, to suggest an alternative, easier approach?