Skip to content

Instantly share code, notes, and snippets.

@ganeshrn
Created September 24, 2020 05:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ganeshrn/3fe905aef0556fbfa7b8c2e466d1c0c5 to your computer and use it in GitHub Desktop.
Save ganeshrn/3fe905aef0556fbfa7b8c2e466d1c0c5 to your computer and use it in GitHub Desktop.
communit.yang.get task example
- name: get interface configuration using cisco iosxr yang model
community.yang.get:
filter: |
<interface-configurations xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg">
<interface-configuration>
<interface-name>GigabitEthernet0/0/0/0</interface-name>
</interface-configuration>
</interface-configurations>
file: "{{ playbook_dir }}/{{inventory_hostname}}/yang_files/Cisco-IOS-XR-ifmgr-cfg.yang"
search_path: "{{ playbook_dir }}/{{inventory_hostname}}/yang_files"
register: result
- name: copy json config to file
copy:
content: "{{ result['json_data'] | to_nice_json }}"
dest: "{{playbook_dir}}/{{inventory_hostname}}/config/interfaces.json"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment