How to see stdout of ansible commands

ansibledebuggingstderrstdout

How do I see stdout for ansible-playbook commands? -v only shows ansible output, not the individual commands. It would be great if I could figure out how to do this immediately, so if something fails or hangs I can see why.

e.g.

- name: print to stdout
  action: command echo "hello"

would print

TASK: [print variable] ******************************************************** 

hello

Best Answer

I think you can register the result to a variable, then print with debug.

- name: print to stdout
  command: echo "hello"
  register: hello

- debug: msg="{{ hello.stdout }}"

- debug: msg="{{ hello.stderr }}"