On Sun, 17 May 2020 13:57:57 -0700 (PDT)
Kernel Panic <[email protected]> wrote:

> List ... contains contains item1, item2, item3, item4, item5. I want to
> remove item1 and 2 (from myvar)
> 
>   - set_fact:
>         list_of_items: "{{ list.stdout_lines|
>                            reject('search', item )| 
>                            list  }}"
>       with_items: "{{ myvar }}"

Use filter "difference". For example

    - set_fact:
        list_of_items: "{{ list.stdout_lines|difference(my_var) }}"

HTH,
        -vlado

-- 
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/20200518000428.06acd8bb%40gmail.com.

Attachment: pgpeo0pHrU1Y3.pgp
Description: OpenPGP digital signature

Reply via email to