ansible / ansible.yang / 2.0.0 / module / fetch Fetch given yang model and it's dependencies Authors: Ganesh Nalawade (@ganeshrn) This plugin has a corresponding action plugin.ansible.yang.fetch (2.0.0) — module
Install with ansible-galaxy collection install ansible.yang:==2.0.0
collections: - name: ansible.yang version: 2.0.0
Fetch given yang model and its dependant yang model from device using netconf rpc.
- name: Fetch given yang model from remote host ansible.yang.fetch: name: "{{ item }}" loop: - openconfig-interface - openconfig-bgp
- name: Fetch list of supported yang model names ansible.yang.fetch:
- name: Fetch all the yang models supported by remote host and store it in dir location ansible.yang.fetch: name: all dir: "{{ playbook_dir }}/yang_files"
- name: Fetch all the yang models supported by remote host and store it in dir location do not stop on error ansible.yang.fetch: name: all dir: "{{ playbook_dir }}/yang_files" continue_on_failure: true
dir: description: - This is an optional argument which provide the directory path in which the fetched yang modules will be saved. The name of the file is same as that of the yang module name prefixed with `.yang` extension. name: description: - Name of the yang model to fetched from remote host. This will also fetch all the dependent yang models and return as part of result. If the value is set to I(all) in that case all the yang models supported by remote host will be fetched. continue_on_failure: default: false description: - This is an optional arguement that allows schema fetch to continue if one the desired models fails download type: bool
failed_yang_modules: description: List of yang models that failed download returned: only when continue_on_failure is true sample: - ietf-netconf-monitoring - cisco-xr-ietf-netconf-monitoring-deviations type: list fetched: description: This is a key-value pair were key is the name of the yang model and value is the yang model itself in string format returned: always apart from low-level errors (such as action plugin) sample: ietf-inet-types: module ietf-inet-types ...<--snip--> type: dict number_schema_fetched: description: Total number of yang model fetched from remote host returned: always apart from low-level errors (such as action plugin) sample: 10 type: int supported_yang_modules: description: List of supported yang models name returned: only when model name is not provided sample: - ietf-netconf-monitoring - cisco-xr-ietf-netconf-monitoring-deviations type: list