Giter Club home page Giter Club logo

automation's Introduction

Ansible Scripts for Automations

alt text

alt text

Create an Ansible playbook to configure, provision, retrieve new Container IPs, and Update the Inventory file for future use

Ansible Cisco Switch Backup

This is a playbook to backup cisco switch configuration, made to run on a daily base

Execution Requirements

  • Tested with Alma8
  • Tested with Ansible 2.9, but keep in mind, that name of modules will change in later version

Variables

It is strongly recommended to protect the passwords in group_vars at least in a vault
https://github.com/joe-speedboat/workshop.ansible/blob/master/20%20Protect%20variables%20with%20vaults.md

  • check ansible config for
    • vault settings
    • group_vars

The following variables may be overridden:

  • ansible_become_password
  • ansible_password
  • config_backup_dir_cisco

How to use

ansible-playbook switchBackup.yml

Dependencies

  • You need an existing git repo with deployment key
    for the backup location: config_backup_dir_cisco
  • You need the ansible collections depending on your ansible version and device types:
  • With this command you can install the needed collections for this specific playbook int the project: ansible-galaxy collection install -r collections/requirements.yml -p collections/

License

https://opensource.org/licenses/LGPL-3.0
Copyright (c) Chris Ruettimann [email protected]

Inventory host_var example

ansible-inventory --list --vars
...snip...
            "fw-asa-01": {
                "ansible_become": true,
                "ansible_become_method": "enable",
                "ansible_become_password": "xxxxxx",
                "ansible_connection": "network_cli",
                "ansible_network_os": "asa",
                "ansible_password": "xxxxxx",
                "ansible_user": "admin",
                "config_backup_dir_cisco": "/etc/git/cisco_backup"
            },
            "switch-01": {
                "ansible_become": true,
                "ansible_become_method": "enable",
                "ansible_become_password": "xxxxxx",
                "ansible_connection": "network_cli",
                "ansible_network_os": "ios",
                "ansible_password": "xxxxxx",
                "ansible_user": "admin",
                "config_backup_dir_cisco": "/etc/git/cisco_backup"
            },
            "wlan-controller-01": {
                "ansible_become": false,
                "ansible_connection": "local",
                "ansible_network_os": "aireos",
                "ansible_password": "xxxxxx",
                "ansible_user": "admin",
                "config_backup_dir_cisco": "/etc/git/cisco_backup"
            }
...snip...

Gitea diff hint

  1. https://git.domain.local/TeamX/backup.cisco
  2. Branch > Tag > choose Date X (eg. 20210101)
  3. Choose Device Config (z.B. as-a-225-02_show_run.txt)
    Now, device config for day X is showing up
  4. Click History
    Now you see all possible versions of this file, which are older than X
  5. On column "Message" choose date Y (eg. 20201218)
    Now you see the diff, "split view" option may help to compare the configs

Ansible-Playbooks-for-Cisco-IOS

Mission:

Ansible-Playbooks-for-Cisco-IOS is a repository of Ansible Playbooks for Cisco IOS devices.

To use, download the .zip and extract the contents or clone the repository by typing

git clone https://github.com/gil906/ansible-playbooks-for-cisco-ios.git

Your host vars should look something like this if you're using Ansible >= 2.5

ansible_pass=foo
ansible_user=foo
ansible_network_os=ios
ansible_connection=network_cli

# If using an enable password add these

ansible_become_pass=foo
ansible_become=yes
ansible_become_method=enable

Here is a link to a blog explaining the changes that took place for Ansible 2.5

https://www.ansible.com/blog/coming-soon-networking-features-in-ansible-2.5

<<<<<<< HEAD

Ansible Cisco Switch Backup

This is a playbook to backup cisco switch configuration, made to run on a daily base

Execution Requirements

  • Tested with Alma8
  • Tested with Ansible 2.9, but keep in mind, that name of modules will change in later version

Variables

It is strongly recommended to protect the passwords in group_vars at least in a vault
https://github.com/joe-speedboat/workshop.ansible/blob/master/20%20Protect%20variables%20with%20vaults.md

  • check ansible config for
    • vault settings
    • group_vars

The following variables may be overridden:

  • ansible_become_password
  • ansible_password
  • config_backup_dir_cisco

How to use

ansible-playbook switchBackup.yml

Dependencies

  • You need an existing git repo with deployment key
    for the backup location: config_backup_dir_cisco
  • You need the ansible collections depending on your ansible version and device types:
  • With this command you can install the needed collections for this specific playbook int the project: ansible-galaxy collection install -r collections/requirements.yml -p collections/

License

https://opensource.org/licenses/LGPL-3.0
Copyright (c) Chris Ruettimann [email protected]

Inventory host_var example

ansible-inventory --list --vars
...snip...
            "fw-asa-01": {
                "ansible_become": true,
                "ansible_become_method": "enable",
                "ansible_become_password": "xxxxxx",
                "ansible_connection": "network_cli",
                "ansible_network_os": "asa",
                "ansible_password": "xxxxxx",
                "ansible_user": "admin",
                "config_backup_dir_cisco": "/etc/git/cisco_backup"
            },
            "switch-01": {
                "ansible_become": true,
                "ansible_become_method": "enable",
                "ansible_become_password": "xxxxxx",
                "ansible_connection": "network_cli",
                "ansible_network_os": "ios",
                "ansible_password": "xxxxxx",
                "ansible_user": "admin",
                "config_backup_dir_cisco": "/etc/git/cisco_backup"
            },
            "wlan-controller-01": {
                "ansible_become": false,
                "ansible_connection": "local",
                "ansible_network_os": "aireos",
                "ansible_password": "xxxxxx",
                "ansible_user": "admin",
                "config_backup_dir_cisco": "/etc/git/cisco_backup"
            }
...snip...

Gitea diff hint

  1. https://git.domain.local/TeamX/backup.cisco
  2. Branch > Tag > choose Date X (eg. 20210101)
  3. Choose Device Config (z.B. as-a-225-02_show_run.txt)
    Now, device config for day X is showing up
  4. Click History
    Now you see all possible versions of this file, which are older than X
  5. On column "Message" choose date Y (eg. 20201218)
    Now you see the diff, "split view" option may help to compare the configs

=======

eae499aa35fdd76c5ac8f37fc95a814f9de3fe54

automation's People

Contributors

gil906 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.