Skip to content

allenrobel/ask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ask - Ansible ScriptKit for NX-OS

README version 104

Ansible ScriptKit is a set of classes and example scripts that can be used to generate Ansible playbooks conformant with the Ansible Cisco NX-OS Collection (cisco.nxos). We use this internally for some of our customer proof of concepts and thought we'd open-source it for anyone else to use and to contribute to.

Goals

  • Remove the need to understand/remember the YAML structure for each of the supported modules
  • Allow for programatic construction of playbooks using familiar python logic constructs
  • Fail quickly. Catch many errors without having to run the playbook against a device
  • Fail clearly. Provide detailed error messages for:
    • Parameters that are mutually-exclusive
    • Parameter values that are out of valid range
    • Missing mandatory parameters

Hence, creating an nxos_ospfv2 playbook looks and feels the same as creating a nxos_feature playbook.

Status

We have completed the initial commit for all NX-OS Ansible modules supported to date. We will be adding support for the remaining modules over the coming weeks/months. We actively monitor the NX-OS Ansible Collections repo and will strive for quick turnaround on additions/changes to the modules that ScriptKit supports.

Also, we've developed a set of classes that can be used to generate Spirent Ansible playbooks (e.g. reserve ports, create emulated devices (including BGP), create StreamBlocks, and start/stop devices and traffic). These are NOT comprehensive. Rather, they focus on our (perhaps relatively simple) use-cases. These get the job done for us for things like ipv4/ipv6 traffic, and convergence test cases. We have added about 50% of what we have, and will try to add the remaining by 2021.02.21. At that time, we will also add a few complete convergence test case playbook generation scripts (configure DUT(s), configure Spirent, start traffic, initiate perturbance, stop traffic, collect statistics).

Roadmap

Over time we hope to add support for ACI, NDFC, etc. We welcome contributions in these and other areas.

Suggestions and bug reports very much appreciated!

Reaching us

  1. Post questions and suggestions in the Discussion forum.
  2. Email us at Ansible ScriptKit

Installing Ansible ScriptKit

If you are using a virtual env, activate it first, then:

Look at your current python module path:

python3
import sys
sys.path

cd into one of the directories in sys.path (or add a new directory to the path and cd into that)

clone the repo

git clone https://github.com/allenrobel/ask.git

Now you should be able to run the unit-test / example scripts. For example:

(ansible-latest) arobel repos % cd ask/unit_test/cisco/nxos 
(ansible-latest) arobel nxos % ./unit_test_nxos_banner.py 
2021-02-01 11:48:16,785 INFO 19.65 unit_test_nxos_banner.<module> wrote playbook /tmp/playbook_nxos_banner.yaml
(ansible-latest) arobel nxos % 

Supported Modules

Status Description
B Beta (under development)
D Deprecated
S Supported
Platform Status Name
NX-OS S cisco.nxos.nxos_aaa_server
NX-OS S cisco.nxos.nxos_aaa_server_host
NX-OS S cisco.nxos.nxos_acl_interfaces
NX-OS B cisco.nxos.nxos_acls
NX-OS S cisco.nxos.nxos_banner
NX-OS S cisco.nxos.nxos_bfd_global
NX-OS S cisco.nxos.nxos_bfd_interfaces
NX-OS D cisco.nxos.nxos_bgp
NX-OS B cisco.nxos.nxos_bgp_address_family
NX-OS D cisco.nxos.nxos_bgp_af
NX-OS B cisco.nxos.nxos_bgp_global
NX-OS D cisco.nxos.nxos_bgp_neighbor
NX-OS B cisco.nxos.nxos_bgp_neighbor_address_family
NX-OS D cisco.nxos.nxos_bgp_neighbor_af
NX-OS S cisco.nxos.nxos_command
NX-OS S cisco.nxos.nxos_config
NX-OS S cisco.nxos.nxos_evpn_global
NX-OS S cisco.nxos.nxos_evpn_vni
NX-OS S cisco.nxos.nxos_feature
NX-OS B cisco.nxos.nxos_gir
NX-OS B cisco.nxos.nxos_gir_profile_management
NX-OS S cisco.nxos.nxos_hsrp
NX-OS S cisco.nxos.nxos_hsrp_interfaces
NX-OS S cisco.nxos.nxos_igmp
NX-OS S cisco.nxos.nxos_igmp_snooping
NX-OS S cisco.nxos.nxos_interfaces
NX-OS S cisco.nxos.nxos_l2_interfaces
NX-OS S cisco.nxos.nxos_l3_interfaces
NX-OS S cisco.nxos.nxos_lacp_interfaces
NX-OS S cisco.nxos.nxos_lag_interfaces
NX-OS S cisco.nxos.nxos_lldp_global
NX-OS S cisco.nxos.nxos_lldp_interfaces
NX-OS S cisco.nxos.nxos_logging
NX-OS S cisco.nxos.nxos_ntp
NX-OS S cisco.nxos.nxos_ntp_auth
NX-OS S cisco.nxos.nxos_ntp_options
NX-OS S cisco.nxos.nxos_nxapi
NX-OS S cisco.nxos.nxos_ospf_interfaces
NX-OS S cisco.nxos.nxos_ospfv2
NX-OS S cisco.nxos.nxos_overlay_global
NX-OS S cisco.nxos.nxos_pim
NX-OS S cisco.nxos.nxos_pim_interface
NX-OS S cisco.nxos.nxos_pim_rp_address
NX-OS B cisco.nxos.nxos_prefix_lists
NX-OS S cisco.nxos.nxos_reboot
NX-OS S cisco.nxos.nxos_snmp_community
NX-OS S cisco.nxos.nxos_snmp_contact
NX-OS S cisco.nxos.nxos_snmp_host
NX-OS S cisco.nxos.nxos_snmp_location
NX-OS S cisco.nxos.nxos_static_routes
NX-OS S cisco.nxos.nxos_system
NX-OS D cisco.nxos.nxos_vlan
NX-OS S cisco.nxos.nxos_vlans
NX-OS S cisco.nxos.nxos_vpc
NX-OS S cisco.nxos.nxos_vpc_interface
NX-OS S cisco.nxos.nxos_vrf
NX-OS S cisco.nxos.nxos_vrf_af
NX-OS S cisco.nxos.nxos_vrf_interface
NX-OS S cisco.nxos.nxos_vtp_domain
NX-OS S cisco.nxos.nxos_vtp_password
NX-OS S cisco.nxos.nxos_vtp_version
NX-OS S cisco.nxos.nxos_vxlan_vtep
NX-OS S cisco.nxos.nxos_vxlan_vtep_vni

ScriptKit Classes

Status Name
S Pause()
S Playbook()

About

Ansible ScriptKit

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published