Sastre-Ansible - Cisco-Sastre Automation Toolset Ansible Collection

The Sastre-Ansible collection exposes Sastre commands to Ansible Playbooks as a set of tasks and lookup plugins. Allowing users to build-up on Sastre functionality to create larger automation workflows.

Ansible version compatibility

This collection has been tested against following Ansible Core release: ==2.16.3.

Modules

Name Description
cisco.sastre.attach_edge Attach templates to WAN Edges
cisco.sastre.attach_vsmart Attach templates to Vsmarts
cisco.sastre.backup Save SD-WAN vManage configuration items to local backup
cisco.sastre.device_bootstrap Performs device bootstrap
cisco.sastre.certificate_restore Restore WAN edge certificate validity status to from a backup
cisco.sastre.certificate_set Set WAN edge certificate validity status
cisco.sastre.delete Delete configuration items on SD-WAN vManage
cisco.sastre.detach_edge Detach templates from WAN Edges
cisco.sastre.detach_vsmart Detach templates from vSmarts
cisco.sastre.encrypt Encrypts password
cisco.sastre.inventory Returns list of SD-WAN devices from vManage
cisco.sastre.list_certificate List configuration items or device certificate information from vManage or a local backup. Display as table or export as csv file
cisco.sastre.list_configuration List configuration items or device certificate information from vManage or a local backup. Display as table or export as csv file
cisco.sastre.list_transform List configuration items or device certificate information from vManage or a local backup. Display as table or export as csv file
cisco.sastre.migrate Migrate configuration items from a vManage release to another
cisco.sastre.report_create Generate a report file containing the output from all list and show-template commands
cisco.sastre.report_diff Generate a report file containing the output from all list and show-template commands
cisco.sastre.restore Restore configuration items from a local backup to SD-WAN vManage
cisco.sastre.settings_enterprise_ca Setting enterprise root certificate
cisco.sastre.show_devices Show Device List
cisco.sastre.show_realtime Realtime commands. Slower, but up-to-date data. vManage collect data from devices in realtime
cisco.sastre.show_state State commands. Faster and up-to-date synced state data
cisco.sastre.show_statistics Statistics commands. Faster, but data is 30 min or more old.Allows historical data queries
cisco.sastre.show_alarms Display vManage alarms
cisco.sastre.show_events Display vManage events
cisco.sastre.show_template_references Show template references about device templates on vManage or from a local backup. Display as table or export as csv/json file
cisco.sastre.show_template_values Show template values about device templates on vManage or from a local backup. Display as table or export as csv/json file
cisco.sastre.transform_copy Transform copy configuration items
cisco.sastre.transform_build_recipe Transform retrieve encrypted passwords
cisco.sastre.transform_recipe Transform using custom recipe
cisco.sastre.transform_rename Transform rename configuration items

Lookup Plugins

Name Description
cisco.sastre.devices Fetches list of SD-WAN devices from vManage
cisco.sastre.realtime Realtime commands. Slower, but up-to-date data. vManage collect data from devices in realtime
cisco.sastre.state State commands. Faster and up-to-date synced state data
cisco.sastre.statistics Statistics commands. Faster, but data is 30 min or more old.Allows historical data queries

Installation

Building the collection

Go to the top-level directory of this repo and run the collection build command:

% ls
CHANGELOG.md		README.md			requirements.txt
Jenkinsfile			cisco				LICENSE

% ansible-galaxy collection build cisco/sastre
Created collection for cisco.sastre at cisco-sastre-1.0.18.tar.gz
  • Note that it creates a tar.gz artifact, which can then be used to install to the ansible environment

Installing the collection

You can install the Sastre-Ansible collection with the Ansible Galaxy CLI:

% ansible-galaxy collection install -f cisco-sastre-1.0.18.tar.gz
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Installing 'cisco.sastre:1.0.18' to '/Users/mareis/.ansible/collections/ansible_collections/cisco/sastre'
cisco.sastre:1.0.18 was installed successfully

Dependencies

In addition to Ansible itself, Sastre need to be installed in the Python environment being used by Ansible.

Please refer to the corresponding README files for Sastre install instructions.

Using Sastre-Ansible in your playbooks

You can call modules by their Fully Qualified Collection Namespace (FQCN), such as cisco.sastre.backup.
The following example task saves vManage configuration to local backup:

---
- name: "Backup vManage configuration"
  cisco.sastre.backup: 
    address: "198.18.1.10"
    port: 8443
    user: admin
    password: admin
    tenant: customer 
    timeout: 300
    verbose: INFO
    workdir: /home/user/backups
    no_rollover: false
    save_running: true
    regex: ".*"
    tags: "all"
View code on GitHub

Code Exchange Community

Get help, share code, and collaborate with other developers in the Code Exchange community.View Community
Disclaimer:
Cisco provides Code Exchange for convenience and informational purposes only, with no support of any kind. This page contains information and links from third-party websites that are governed by their own separate terms. Reference to a project or contributor on this page does not imply any affiliation with or endorsement by Cisco.