08-10-2022 11:18 PM
I feel with the synergies with ansible it is a real missed opportunity that there is no way to get structured data out as yaml unless i am missing something?
As far as i can tell in all the doco it is xml or json only. I have even just tried to get yaml output with no luck.
08-11-2022 04:35 AM
By default Ansible sends output of the plays, tasks and module arguments to STDOUT
in the format that is not suitable for human reading. Starting from Ansible 2.5, the default output format can be changed to a human-readable using the callback plugin.
To change the Ansible’s output format you can pass the ANSIBLE_STDOUT_CALLBACK=yaml
environment variable on the command line or define the stdout_callback = yaml
in Ansible configuration file.
Run a playbook and get the output in the human-readable format:
$ ANSIBLE_STDOUT_CALLBACK=yaml ansible-playbook playbook.yml
You can also define the stdout_callback = yaml
in ansible.cfg
:
[defaults] stdout_callback = yaml
08-11-2022 05:45 AM
Sorry i might not have been clear. I meant talking to the cisco restconf api.
Not specific to ansible in this case.
GET /restconf HTTP/1.1
Host: example.com
Accept: application/yang-data+json
GET /.well-known/host-meta HTTP/1.1
Host: example.com
Accept: application/xrd+xml
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide