On 04.03.2019 09:11, [email protected] wrote:
Hi,

I tried the following, im saving the output to a file and trying that to
copy to a file. but not working can any one help.

---
- hosts: windows
  remote_user: admin
  tasks:
  - name: rest api
    win_uri:
      url: http://example.com
      method: GET
      register: json_ouput

Your register is indented to far, it must be on the same level as name and win_uri.


  - name: copying the content to a file
copy: content="{{ json_ooutput}}" dest=/path/to/destination/file_name

copy is for linux, win_copy is for Windows.

And if you check the documentation under return values for win_uri
https://docs.ansible.com/ansible/2.4/win_uri_module.html#return-values
you see that the output will be in json_ouput.content or json_ouput.json depending on the use of the module and the return of the server.

You can always use this to see the content.

- debug: var=json_ouput

--
Kai Stian Olstad

--
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/f8e4edf23fa593e739c22338d7eb1d52%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to