On 04.03.2019 09:11,
shyam...@gmail.com 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