ansible.netcommon.cli_backup (6.1.0) — module

Back up device configuration from network devices over network_cli

| "added in version" 4.2.0 of ansible.netcommon"

Authors: Kate Case (@Qalthos)

This plugin has a corresponding action plugin.

Install collection

Install with ansible-galaxy collection install ansible.netcommon:==6.1.0


Add to requirements.yml

  collections:
    - name: ansible.netcommon
      version: 6.1.0

Description

This module provides platform agnostic way of backing up text based configuration from network devices over network_cli connection plugin.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: configurable backup path
  ansible.netcommon.cli_backup:
    filename: backup.cfg
    dir_path: /home/user

Inputs

    
defaults:
    default: false
    description:
    - The I(defaults) argument will influence how the running-config is collected from
      the device.  When the value is set to true, the command used to collect the running-config
      is append with the all keyword.  When the value is set to false, the command is
      issued without the all keyword.
    type: bool

dir_path:
    description:
    - This option provides the path ending with directory name in which the backup configuration
      file will be stored. If the directory does not exist it will be first created and
      the filename is either the value of C(filename) or default filename as described
      in C(filename) options description. If the path value is not given in that case
      a I(backup) directory will be created in the current working directory and backup
      configuration will be copied in C(filename) within I(backup) directory.
    type: path

filename:
    description:
    - The filename to be used to store the backup configuration. If the filename is not
      given it will be generated based on the hostname, current time and date in format
      defined by <hostname>_config.<current-date>@<current-time>
    type: str

Outputs

backup_path:
  description: The full path to the backup file
  returned: always
  sample: /playbooks/ansible/backup/hostname_config.2016-07-16@22:28:34
  type: str