On Tue, 12 Jul 2022 11:29:09 +0200
Vladimir Botka <[email protected]> wrote:

>     - debug:
>         msg: "Launch task for user {{ item.user }} end date."
>       loop: "{{ users.list }}"
>       when: item.end == today
>     - debug:
>         msg: "Launch task for user {{ item.user }} start date."
>       loop: "{{ users.list }}"
>       when: item.start == today

Instead of the condition, use more efficient *selectattr*. The tasks
below give the same result

    - debug:
        msg: "Launch task for user {{ item.user }} end date."
      loop: "{{ users.list|selectattr('end', '==', today) }}"
    - debug:
        msg: "Launch task for user {{ item.user }} start date."
      loop: "{{ users.list|selectattr('start', '==', today) }}"

-- 
Vladimir Botka

-- 
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/20220712113822.2e3d5bd4%40gmail.com.

Attachment: pgpd3NsZlvW4z.pgp
Description: OpenPGP digital signature

Reply via email to