cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
823
Views
0
Helpful
2
Replies

Restconf Yaml

sapage
Level 1
Level 1

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. 

 

2 Replies 2

@sapage 

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

 

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

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