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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/956a1e2a43b91e7a709cd4e3368a3d03%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to