FreeKB - ansible-playbook command - register shell command stdout stderr rc
ansible-playbook command - register shell command stdout stderr rc

Home > Search


This assumes you have installed Ansible Tower and are familiar with the ansible-playbook command and the shell command.

Register can be used to store the output and return code of a command. In this example, the output and return code of the ps command will be stored in "out".

- name: ps command
  shell: "ps"
  register: out

 

You can then do something with the register, such as printing the output and return code.

- debug: msg="{{out.stdout_lines}}"
- debug: msg="{{out.stderr}}"
- debug: msg="{{out.rc}}"

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 205e0 in the box below so that we can be sure you are a human.




Comments