Stdout processing

31 views
Skip to first unread message

Eric Marquez

unread,
Jul 18, 2016, 8:52:33 AM7/18/16
to ansible...@googlegroups.com

Simple question, what’s the best way to capture stdout from a task that is performed?  For example I want to run a command to gather some telemetry from a switch but is using the debug the best way to get the stdout data?  I feel like there is a different way to do this without using debug.

 

 

---

- name: show mac address-table

  register: output

  nxos_command:

    commands:

      - show mac address-table | json

    provider: "{{ cli }}"

- name: output debug for mac address-table

  debug: var=output

 

 

- name: copy output to file

  copy:

    content: "{{ output.stdout_lines }}\n"

    dest: /var/tmp/macaddress.txt

 

 

Sent from Mail for Windows 10 [14393 - 16.0.7167.4026]

 

Peter Sprygada

unread,
Jul 19, 2016, 6:42:55 AM7/19/16
to ansible...@googlegroups.com
Use a registered variable to access the return data.  


More about registered variables here: http://docs.ansible.com/ansible/playbooks_variables.html#sts=Registered Variables%C2%B6


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CY1PR0301MB12609B3A9DA5F3E17B7B4C39DD360%40CY1PR0301MB1260.namprd03.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages