Search

1 to 3 of 3
Sort by

Discussion Post
[Ansible] junos_get_config to get configuration with inheritance defaults values

Hello, For an automation purpose, I'm trying to reproduce the following command in Ansible: show configuration | display xml | display inheritance defaults But I can't find a way to have the inheritance defaults values in the retrieved configuration


Discussion Thread 3
[Ansible] junos_get_config to get configuration with inheritance defaults values

Focus Search - Hi NSI, The option should do the trick for your use case. " To retrieve data from the post-inheritance configuration, which displays statements that are inherited from user-defined groups and ranges as children of the inheriting statements, you can include the options argument with inherit: "inherit" Now, if we check the RPC, the "defaults" value for the inherit option is also present - https://www.juniper.net/documentation/en_US/junos/topics/reference/tag-summary/junos-xml-protocol-get-configuration.html This worked for me - -- - name: Get Configuration Inheritence Defaults hosts: - all roles: - Juniper.junos connection: local gather_facts: no vars_prompt: - name: username prompt: Junos Username private: no - name: password prompt: Junos Password private: yes tasks: - name: "Get = show configuration | display inheritence defaults | display xml" juniper_junos_config: retrieve: "committed" options: inherit: "defaults" provider: host: "(( ansible_host ))" port: 22 user: "(( username ))" passwd: "(( password ))" format: xml return_output: true Result: PLAYBOOK: config-inherit-defaults.yaml ************************************************************************************************************************************************************** 1 plays in config-inherit-defaults.yaml Junos Username: xxx Junos Password: PLAY [Get Configuration Inheritence Defaults] ******************************************************************************************************************************************************* META: ran handlers TASK [Get = show configuration | display inheritence defaults | display xml] ************************************************************************************************************************ ok: [sony] => ( "changed": false, "config_lines": [ " 16.1R6-S3.1 ", " #", "# Defines the default for dynamic-profiles", "# ", " ", " junos-default-profile ", " ", " junos-interface-unit ", " ", " interface_unit_number|unit-number unit interface interface-set ", REF: Using Ansible to Retrieve or Compare Junos OS Configurations. ======================================== Please mark this solution as "Accepted" if it works


Blog Entry
Scripting How-To: Correct pre-inheritance configuration

Correct Pre-Inheritance Configuration for Commit Scripts For SLAX version 1.0 and higher, at times, a commit script requires access to the pre-inheritance configuration rather than the post-inheritance configuration it receives by default