On Tue, 12 Jan 2021 16:03:14 +0100 Akshay Kumar <[email protected]> wrote:
> List1: ['dba','admin','developer']
> List2: [' user1: dba admin' ,
> 'user2 : dba developer',
> 'user3 : operator',
> 'testdbauser: root']
>
> ... i can still get testdbauser in the output of List3
Try
- set_fact:
List3: "{{ List3|default([]) + [key|trim] }}"
loop: "{{ List2 }}"
vars:
key: "{{ item.split(':').0 }}"
val: "{{ item.split(':').1.split() }}"
when: val|intersect(List1)
--
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/20210112191235.0e6f8b35%40gmail.com.
pgp9lQqlyPCEW.pgp
Description: OpenPGP digital signature
