I am new to Ansible and my play looks like this:
- name: "Spark Submit Command"
shell: "{{ sparkCommand }}"
register: spark_output
- debug: msg="{{ spark_output.stdout }}"
I have around 60 lines in my spark_output.stdout and getting the output as below:
ok: [DHADLX110] => {
"msg": "Line1\nLine2\nLine3...........Line.."
Is it possible to print these line by line or in a proper dialog box? Something similar to below format:
Line1
Line2
.
.
.
Line60
When you register command output, Ansible will give you stdout
and stdout_lines
.
If you change your debug task to:
- debug:
var: spark_output
You will see that it also returns stdout_lines
. So instead of spark_output.stdout
use:
- debug:
msg: "{{ spark_output.stdout_lines }}"