Thanks a lot Kai for the response. Here I don't want to include the vars, 
just want to check if the file exists and it contains the string.

Is there any alternate? I meant without using the include_vars option.

--
Bijay


On Sunday, 20 May 2018 13:58:31 UTC+5:30, Kai Stian Olstad wrote:
>
> On 20.05.2018 07:48, BIJAY PARIDA wrote: 
> > I have two files file1.yml and file2.yml which I am passing from the 
> > deployment level. 
> > 
> > I want to verify that all the values of the file1 matches to a string 
> > else 
> > exits with error message, same with the 2nd file. 
> > 
> > 
> > file1.yml (value field is same) 
> > ======================= 
> > 
> > "item1" : "value" 
> > "item2" : "value" 
> > "item3" : "value" 
> > 
> > 
> > file2.yml (value2 field is same) 
> > ======================= 
> > 
> > "item1" : "value2" 
> > "item2" : "value2" 
> > "item3" : "value2" 
> > 
> > Both value1 and value2 are different and I want to check the respective 
> > files and their values. 
> > 
> > And assert the condition file1.values | uniqe == value1 
>
> Not pretty but it should get the job done. 
>
>    - include_vars: 
>        file: file1.yml 
>        name: file1 
>
>    - set_fact: 
>        file1values: "{{ file1values | default([]) + [item.1] }}" 
>      with_items: 
>        - "{{ file1 | dictsort }}" 
>
>    - assert: 
>          that: file1values | unique | length == 1 
>
> -- 
> Kai Stian Olstad 
>

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ae3d1203-0473-4c6b-ba2f-31f33ddee646%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to