Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
share|improve this question

1 Answer 1

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 }}"
share|improve this answer
    
Thanks @bfschott, that worked. –  Sathish Dec 19 '13 at 12:38
1  
Additionally, you can debug a variable directly with - debug: var=hello. Sometimes this is more helpful for multiline output or Ansible module output (rather than command/shell output). –  geerlingguy Mar 8 at 3:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.