Re: [ansible-project] find element with dictionary in Ansible and return value

2022-07-21 Thread Brian Coca
First you conflate site as both a variable and a string, showing both examples below to make the distinction clear. You don't need key/keys() nor quotes if 'site' is a variable when: site in sites You seem to use site as both var and string, if site is a string, you need quotes when: "

Re: [ansible-project] find element with dictionary in Ansible and return value

2022-07-21 Thread Abhijeet Kasurde
The last task should be - ``` - debug: msg: "{{ sites[site] }}" when: "site in sites.keys()" On Wed, Jul 20, 2022 at 4:02 PM maulik patel wrote: > hi , > > i'm trying to value of one yaml file1 with another file2 which has list of > dict and if element if file1 matched with key/value of file2 t

[ansible-project] find element with dictionary in Ansible and return value

2022-07-20 Thread maulik patel
hi , i'm trying to value of one yaml file1 with another file2 which has list of dict and if element if file1 matched with key/value of file2 then need to use value of file1 need to use as a key of file2 and return value of it... not sure how we can leverage "when" condition or might any other w