junos_get_config - Retrieve configuration of device

Author:Rick Sherman, Juniper Networks

Synopsis

New in version 1.2.0.

Retrieve the configuration of a device running Junos and save it to a file. Note unicode chars will be converted to ‘??’ as also done in PyEZ

Options

parameter required default choices comments
dest yes None
    Path to the local server directory where configuration will be saved.
    filter no None
      Defines heircachy of configuration to retrieve. If omitted entire configuration is retrieved. Format is slash notation ex groups/routeinst/routing-instances/ISP-1
      format no text
      • text
      • xml
      text - configuration saved as text (curly-brace) formatxml - configuration saved as XML
      host yes
        Set to {{ inventory_hostname }}
        logfile no None
          Path on the local server where the progress status is logged for debugging purposes
          mode no None
            mode of console connection (telnet/serial). If mode is not provided SSH connection is used.
            options no None
              Additional options to pass to get_config. Refer to jnpr.junos.rpcmeta.get_config for details.
              passwd no assumes ssh-key active
                Login password
                port no 830
                  port number to use when connecting to the device
                  ssh_private_key_file no None
                    This can be used if you need to provide a private key rather than loading the key into the ssh-key-ring/environment. if your ssh-key requires a password, then you must provide it via **passwd**
                    user no $USER
                      Login username

                      Note

                      Requires junos-eznc >= 1.2.2

                      Examples


                      - junos_get_config:
                         host: "{{ inventory_hostname }}"
                         logfile: get_config.log
                         dest: "{{ inventory_hostname }}.xml"
                         format: xml
                         filter: "interfaces"
                         options: {inherit: inherit, groups: groups}
                      
                      # over console server connection using PyEZ >= 2.0
                      - junos_get_config:
                         host: "{{ inventory_hostname }}"
                         logfile: get_config.log
                         dest: "{{ inventory_hostname }}.xml"
                         port: 7016
                         mode: 'telnet'
                         format: xml