print the register output with proper format on the screen

8 views
Skip to first unread message

Veera

unread,
Nov 8, 2022, 1:12:16 PM11/8/22
to Ansible Project
Hi everyone ,

I am trying to   print 2  files in my ansible server itself, which are already copied from other servers ,  which means the filenames have hostnames and date within it.

- name: compare the output files
 local_action:  command  /usr/bin/sdiff   "{{ logs_dir }}"/{{ inventory_hostname }}-Precheck-{{ ansible_date_time.date }}.txt     "{{ logs_dir }}"/{{ inventory_hostname }}-Postcheck-{{ansible_date_time.date }}.txt
register: result

- debug:
      var:  result.output

I am able to print the output I expected ..but it collapses   than expected.
Is there a way to Print them as like as in a linux bash    "  # diff file1 file2 "

redirecting the output to a file and printing is also  helping






Reply all
Reply to author
Forward
0 new messages