I have a file that I want to print as debug msg line.
cat result.txt
## BEGIN :## Role Name: Deployment Checks
## REASON:- ERROR: Deployment Checks output from command FATAL: TEST FAILED.
## END :## Role Name: Deployment Checks ##
## BEGIN :## Role Name: Describe the instance
## REASON:- ERROR: Describe the instance FATAL: TEST FAILED.
## END :## Role Name: Describe the instance ##
I m using the below code to print them on the console
- name: Read result
shell: "cat result.txt | grep 'REASON:-'"
register: result
- name: print checks fail.
debug:
msg:
- "Check Failed!"
- "{{ result.stdout_lines }}"
Which prints below output in an ugly format as single line
TASK [ print checks fail.] **************************************************
fatal: [10.203.116.90]: FAILED! => {"changed": false, "msg": ["Check Failed!", ["REASON:- ERROR: Deployment Checks output from command", "REASON:- ERROR: Describe the instance "]]}
How can I print every reason as a single line? So that output is more readable. Something like below
TASK [ print checks fail.] **************************************************
fatal: [10.203.116.90]: FAILED! => {"changed": false, "msg":
["Check Failed!",
["REASON:- ERROR: Deployment Checks output from command",
"REASON:- ERROR: Describe the instance "]]}