ntc_save_config

Synopsis

Added in version 1.9.2

Save the running configuration as the startup configuration or to a file on the network device. Optionally, save the running configuration to this computer. Supported platforms include Cisco Nexus switches with NX-API, Cisco IOS switches or routers, Arista switches with eAPI.

Options

parameter required default choices comments
host yes
    Hostame or IP address of switch.
    local_file no
      Name of local file to save the running configuration. If omitted it won't be locally saved.
      ntc_conf_file no
        The path to a local NTC configuration file. If omitted, and ntc_host is specified, the system will look for a file given by the path in the environment variable PYNTC_CONF, and then in the users home directory for a file called .ntc.conf.
        ntc_host no
          The name of a host as specified in an NTC configuration file.
          password yes
            Password used to login to the target device.
            platform yes
            • cisco_nxos_nxapi
            • cisco_ios
            • arista_eos_eapi
            Vendor and platform identifier.
            port no
              TCP/UDP port to connect to target device. If omitted standard port numbers will be used. 80 for HTTP; 443 for HTTPS; 22 for SSH.
              remote_file no
                Name of remote file to save the running configuration. If omitted it will be saved to the startup configuration.
                secret no
                  Enable secret for devices connecting over SSH.
                  transport no
                  • http
                  • https
                  Transport protocol for API. Only needed for NX-API and eAPI. If omitted, platform-specific default will be used.
                  username yes
                    Username used to login to the target device.

                    Important

                    Requires pyntc

                    Examples


                    - ntc_save_config:
                        platform: cisco_nxos_nxapi
                        host: "{{ inventory_hostname }}"
                        username: "{{ username }}"
                        password: "{{ password }}"
                    
                    - ntc_save_config:
                        ntc_host: n9k1
                    
                    - ntc_save_config:
                        platform: arista_eos_eapi
                        host: "{{ inventory_hostname }}"
                        username: "{{ username }}"
                        password: "{{ password }}"
                        remote_file: running_config_copy.cfg
                        transport: https
                    
                    # You can get the timestamp by setting get_facts to True, then you can append it to your filename.
                    
                    - ntc_save_config:
                        platform: cisco_ios
                        host: "{{ inventory_hostname }}"
                        username: "{{ username }}"
                        password: "{{ password }}"
                        local_file: config_{{ inventory_hostname }}_{{ ansible_date_time.date | replace('-','_') }}.cfg
                    

                    Return Values

                    Common return values are documented here common_return_values, the following are the fields unique to this module:

                    name despcription returned type sample
                    local_file The local file path of the saved running config. success string /path/to/config.cfg
                    remote_file The remote file name of the saved running config. success string config_backup.cfg
                    remote_save_successful Whether the remote save was successful. May be false if a remote save was unsuccessful because a file with same name already exists. success bool True


                    Note

                    This module is not idempotent.