Use a registered variable to access the return data.

See example here:
https://gist.github.com/privateip/6d3c2eb6a7301a4d20eda17af2b19be0

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


On Mon, Jul 18, 2016 at 8:52 AM, Eric Marquez <[email protected]> wrote:

> 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 <https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows 10 [14393 - 16.0.7167.4026]
>
>
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CY1PR0301MB12609B3A9DA5F3E17B7B4C39DD360%40CY1PR0301MB1260.namprd03.prod.outlook.com
> <https://groups.google.com/d/msgid/ansible-project/CY1PR0301MB12609B3A9DA5F3E17B7B4C39DD360%40CY1PR0301MB1260.namprd03.prod.outlook.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEkdrMh%3DN%2BEOT_Joj_ou7hZ2qMF3WmtiVVWPJRb6KCaWOJVmfA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to