Skip to content

Ansible role to pull network configs, then save them to a git repository.

Notifications You must be signed in to change notification settings

gregsowell/network_backup_git

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 

Repository files navigation

Role Name

This role does network device backups, then saves the results to a git repository. It currently only supports Cisco, Arista, Juniper, and Mikrotik.

Requirements

A git repository, private, not public like I use for testing here should be established. An SSH key should be used to prevent the script from prompting for credentails. This key should be fairly easy to setup. Also your repo clone should be in the form [email protected]:account/repo so that it will use SSH to pull and push.

Role Variables

Check the default folder for configurable variables:

---
# defaults file for network_backup_git
# the local git repo where configs are stored for push/pull
backup_dir: "{{ playbook_dir }}/net_backups"

# what format to save the file as in the git repo
backup_file: "{{ backup_dir }}/{{ inventory_hostname }}"

# location of the repo
backup_repo: [email protected]:gregsowell/net_backups

# git update details
git_name: Greg Sowell
git_email: [email protected]

Dependencies

NA

Example Playbook

---
- name: network device backup to git
  hosts: crtr3
  gather_facts: false
  vars:
    backup_dir: "{{ playbook_dir }}/net_backups"
    backup_file: "{{ backup_dir }}/{{ inventory_hostname }}"
    backup_repo: [email protected]:gregsowell/backups
    git_name: Git Backup
    git_email: [email protected]
  
  tasks:

  - import_role:
      name: network_backup_git

License

BSD

Author Information

Greg Sowell - GregSowell.com or TheBrothersWISP.com

About

Ansible role to pull network configs, then save them to a git repository.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published