Ask Question <https://stackoverflow.com/questions/ask>
-1

I've one playbook which runs on 2,3 hosts. I want to compare output of a
command run on host 1 with output of command run on host 2

Something like below


- hosts: 1,2,3

  tasks:
   - name: Check file in tmp
     shell: ls -ltrh /tmp/a.txt
     register : tmp1
     when: "'1' in group_names"

   - name: Checking file in /tmp
     shell: ls -ltrh /tmp/b.txt
     when: "'2' in group_names"
     register: tmp2

   - name: Checking file in /tmp
     command: /bin/true
     failed_when:  tmp1 != tmp2

It is not evaluating the condition. Giving error :

fatal: [host2]: FAILED! => {"msg": "The conditional check 'tmp1 != tmp2'
failed. The error was: error while evaluating conditional ( tmp1 != tmp2):
'dict object' has no attribute 'stdout'"}

-- 
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/CAPWPJXZ3GXaSvhgyapuK7ANRXj1ejq%2BdTuW%3DCwamtf2dCLf2ag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to