I'm trying to loop over a set of strings with ansible.builtin.debug, and I 
want to produce a three-part message for each string, like this:

- name: Demo expressions
  ansible.builtin.debug:
    msg:
      - '{{ item }}'
      - '*evaluate item as a Jinja2 expression*'
      - '*like previous, but with "| bool" appended*'
  loop:
    - "0"
    - "1"
    - "2"
    - "['aa', 'bb', 'cc'] | intersect(['bb', 'cc'])"
    - "['aa', 'bb', 'cc'] | intersect(['bb', 'cc']) | length > 0"

The first part of the message should show the string, and it does.
The second part somehow needs to show the result of evaluating the string 
as a Jinja2 expression.
The third part is supposed to append "| bool" onto the string, evaluate 
_that_ as a Jinja2 expression, and show the result.

I feel like there should be some way to do this with lookup('items',...), 
but I'm having no luck. I'd appreciate any suggestions. Thanks,
--
Todd

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/00fa51d7-9290-4243-970f-d00be019c4ban%40googlegroups.com.

Reply via email to