Cisco asa backup playbook

Can someone kindly assist with cisco asa backup playbook template.
Thank you.

Hello @FELIXmu

How about using cisco.asa.asa_config module?

example:

- name: configurable backup path
  cisco.asa.asa_config:
    backup: yes
    backup_options:
      filename: backup.cfg
      dir_path: /home/user
1 Like

On this config, where are the remote devices defined?
Where are the commands to be run?

would below work?

  • name: configurable backup path
    cisco.asa.asa_config:
    lines:
    - show run
    backup: yes
    backup_options:
    filename: backup.cfg
    dir_path: /home/user

does this do it?

  • name: Run ASA Config Backup
    hosts: your_asa_device
    gather_facts: no
    tasks:
    • name: Configurable Backup Path
      cisco.asa.asa_config:
      lines:
      - show run
      backup: yes
      backup_options:
      filename: backup.cfg
      dir_path: /home/user
      gather_facts: no

You can create a backup file backup.cfg with the following task.
It is not necessary to specify an explicit show running-config command.

    - name: backup config
      cisco.asa.asa_config:
        backup: true
        backup_options:
          filename: backup.cfg
          dir_path: ./

And you need define remote devices in the inventory file.

1 Like

If i have different devics in the inventory file? how does the playbook know which are ASA or target devices, yet on the playbook i dont see any host configured?

The special variable inventory_hostname indicates each inventory hostnames.

Therefore, you can create a backup file for each device by using the following for the file name.

    - name: backup config
      cisco.asa.asa_config:
        backup: true
        backup_options:
          filename: "{{ inventory_hostname }}_backup.cfg"
          dir_path: ./

In this case, for example, asa01_backup.cfg and asa02_backup.cfg will be created.

1 Like