Giter VIP home page Giter VIP logo

napalm-ansible's Introduction

napalm-ansible

Collection of ansible modules that use napalm to retrieve data or modify configuration on networking devices.

Modules

The following modules are currently available:

  • napalm_diff_yang
  • napalm_get_facts
  • napalm_install_config
  • napalm_parse_yang
  • napalm_ping
  • napalm_translate_yang
  • napalm_validate

Actions

Actions will only work with Ansible version 2.3 or greater. They provides default parameters for the hostname, username, password and timeout paramters.

  • hostname is set to the first of provider {{ hostname }}, provider {{ host }}, play-context remote_addr.
  • username is set to the first of provider {{ username }}, play-context connection_user.
  • password is set to the first of provider {{ password }}, play-context password (-k argument).
  • timeout is set to the provider {{ timeout }}, or else defaults to 60 seconds (can't be passed via command-line).

Install

To install just run the command:

pip install napalm-ansible

Configuring ansible

Once you have installed napalm-ansible run the command napalm-ansible and follow the instructions. For example::

$ napalm-ansible
To make sure ansible can make use of the napalm modules you will have
to add the following configuration to your ansible configuration
file, i.e. `./ansible.cfg`:

    [defaults]
    library = /Users/dbarroso/workspace/napalm/napalm-ansible/napalm_ansible
    action_plugins = /Users/dbarroso/workspace/napalm/napalm-ansible/action_plugins

For more details on ansible's configuration file visit:
https://docs.ansible.com/ansible/latest/intro_configuration.html

Dependencies

Examples

Example to retrieve facts from a device

 - name: get facts from device
   napalm_get_facts:
     hostname={{ inventory_hostname }}
     username={{ user }}
     dev_os={{ os }}
     password={{ passwd }}
     filter='facts,interfaces,bgp_neighbors'
   register: result

 - name: print data
   debug: var=result

Example to install config on a device

- assemble:
    src=../compiled/{{ inventory_hostname }}/
    dest=../compiled/{{ inventory_hostname }}/running.conf

 - napalm_install_config:
    hostname={{ inventory_hostname }}
    username={{ user }}
    dev_os={{ os }}
    password={{ passwd }}
    config_file=../compiled/{{ inventory_hostname }}/running.conf
    commit_changes={{ commit_changes }}
    replace_config={{ replace_config }}
    get_diffs=True
    diff_file=../compiled/{{ inventory_hostname }}/diff

Example to get compliance report

- name: GET VALIDATION REPORT
  napalm_validate:
    username: "{{ un }}"
    password: "{{ pwd }}"
    hostname: "{{ inventory_hostname }}"
    dev_os: "{{ dev_os }}"
    validation_file: validate.yml

Example to use default connection paramters:

 - name: get facts from device
   napalm_get_facts:
     dev_os: "{{ os }}"
     filter: facts,interfaces,bgp_neighbors

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.