Cisco Services APIs Ansible Playbooks
Written by John Capobianco, Francois Daigle, and Devin Sloan
Cisco has several APIs to get different information returned in JSON format. Using the Ansible URI Module you can access these APIs, query the JSON output, and create formatted CSV files.
Support API
- Bug information
- TAC case information
- End-of-X information
- Product information
- RMA information
- Software Suggestion (Gold Star)
Services API
- Contracts and Coverage information
- Customer information
- Inventory information
- Product Alerts (Field Notice, Security Advisory, Security Vulnerability)
Product Security Incident Reponse Team
- Accelerate Cisco Security Vulnerability Assessments
- Customize Cisco Vulnerability Notifications
- Use Open Security Standards
Business Critical Insights
BCI portal shows various key performance indicators, trends and predictive analytic insights. The data shown on the portal is now also available through APIs.
Onboarding Process
SmartNet Total Care (SNTC)
Cisco account must have API Developer role
- Log in Cisco.com
- Go to Manage Profile
- Smart Services section
- API Developer role = Active
If not, click on Contact Company Adminstrator to know who to ask to get it.
Cisco API console
Create an application add assign APIs
Please take note of:
- KEY: OAuth2.0 {{ client_id }}
- CLIENT_SECRET: OAuth2.0 {{ client_secret }}
Prerequisites
-
Install Ansible
$ pip install --user ansible
-
Check version of Ansible
$ansible --version
ansible 2.9.1
-
Install JMESPATH
pip install --user jmespath
-
Clone the Repository
git clone https://github.com/automateyournetwork/Cisco_API_v2.git
RecommendedRelease.yml
-
Run ansible-playbook RecommendedRelease.yml
-
Supply Client ID (obtained from Cisco.com API dashboard)
-
Supply Client Key (obtained from Cisco.com API dashboard)
-
Provide Git Commit Message when prompted
-
Provide Git repository credentials when prompted
-
Check output .CSV files
You can pass a maximum of 10 comma separated PIDs. The playbook currently has 2 groups with a variety of example PIDs. Simply replace them with your own PIDs.
The playbook is expecting to be in a Git repository and automatically performs the Git Add, Commit, and Push at the end of the playbook.
SerialToInfo.yml
-
Run ansible-playbook SerialToInfo.yml
-
Supply Client ID (obtained from Cisco.com API dashboard)
-
Supply Client Key (obtained from Cisco.com API dashboard)
-
Supply a single or up to 10 comma separated serial numbers
-
Provide Git Commit Message when prompted
-
Provide Git repository credentials when prompted
-
Check output .CSV files
The playbook is expecting to be in a Git repository and automatically performs the Git Add, Commit, and Push at the end of the playbook.