On Thu, 30 Jan 2020 04:49:02 -0800 (PST) Rakesh Parida <[email protected]> wrote:
> Hi ,
>
> I want to compare two lists.
> [...]
> my playbook:
> - hosts: localhost
> tasks:
> - name: Create a list1
> set_fact:
> list1:
> - dp-steps-common-3.0.12
> - iam-python-common-1.0.1
> - iam-service-default-3.1.37
> list2:
> - dp-steps-common-3.0.15-1911280809_d103a.noarch
> - iam-python-common-1.0.1-1910242116.noarch
> - iam-service-default-3.1.37-1911141021_63e48.noarch
Is this what you're looking for?
- debug:
msg: "{{ item }} is in the list2"
loop: "{{ list1 }}"
when: list2|select('match', item)|list
gives
"msg": "iam-python-common-1.0.1 is in the list2"
"msg": "iam-service-default-3.1.37 is in the list2
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/20200130145045.3cc14cd1%40gmail.com.
pgp51jgl1a1Qw.pgp
Description: OpenPGP digital signature
