A repository for Cisco Prime Device Facts Ansible playbooks using the Cisco Prime API
These playbooks have been developed and tested under Ansble 2.9.1 on CentOS 7.8.2003
You will require Git, Ansible, Node.js 12, and Mark Map
$ sudo yum -y update
$ sudo yum install epel-release
$ sudo yum install ansible
$ curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -
$ sudo yum install -y gcc-c++ make
$ sudo yum install -y nodejs
$ npm install markmap-lib -g
$ sudo apt update
$ sudo apt-get upgrade -y
$ sudo apt-get install python -y
$ sudo apt-add-repository ppa:ansible/ansible
$ sudo apt-get update
$ sudo apt-get install ansible -y
$ sudo apt install npm
$ npm install markmap-lib -g
These playbooks require the Windows Subsystems for Linux and the Ubuntu OS from the Microsoft Store.
Aside from this requirement, the Linux prequisites similarly apply to Windows 10.
Wait for Ubuntu to install.
Press Windows Key and start typing Ubuntu - click and launch Ubuntu.
The first time Ubuntu launches it has to setup - give this some time.
Enter your username and password for Ubuntu.
Update Ubuntu - this step will take some time.
$ sudo apt update
$ sudo apt-get upgrade -y
$ sudo apt-get install python -y
$ sudo apt-add-repository ppa:ansible/ansible
$ sudo apt-get update
$ sudo apt-get install ansible -y
$ sudo apt install npm
$ sudo npm install markmap-lib -g
git clone https://github.com/automateyournetwork/CiscoPrimeFacts.git
Modify the permissions
chmod -R 755 /home/"username"/CiscoPrimeFacts
To work around a bug that prevents the Ansible playbook from running on certain versions of Ubuntu please run the following:
sudo mv /usr/bin/sleep /usr/bin/sleep.dist
sudo ln -s /bin/true /usr/bin/sleep
Enable Read access for a Prime User
Update the base URL variable to be your Cisco Prime appliance URL
api_base_url: "https://x.x.x.x/webacs/api/"
Update the address field with the IP of your Cisco Prime appliance
address: x.x.x.x
A sample hosts structure has been created and the playbook currently targets all devices under ENTERPRISE
Adjust the scope of your play in the playbooks\CiscoPrimeDeviceFacts.yml to target the group or device you want
- hosts: ENTERPRISE
cd CiscoPrimeFacts/playbooks
ansible-playbook CiscoPrimeDeviceFacts.yml
ansible-playbook ansible-playbook CiscoPrimeDeviceFacts.yml --limit "hostname or groupname"
ansible-playbook CiscoPrimeAPFacts.yml
ansible-playbook ansible-playbook CiscoPrimeAPFacts.yml --limit "hostname or groupname"
Host not in Prime:
fatal: [{{inventory_hostname}}]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'entityId'\n\nThe error appears to be in '/home/usr/Prod-Infrastructure/playbooks/prime/CiscoPrimeDeviceFacts.yml': line 33, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n# Set Device Fact #\n - name: Set Device Fact\n ^ here\n"}
Host does not have Access Points:
fatal: [{{inventory_hostname}}]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "msg": "Xpath /queryResponse/entityId does not reference a node!"}
The Reports are stored in CiscoPrimeFacts/documentation.
/json
Contains the RAW JSON output.
/yaml
Contains the RAW YAML output.
/csv
Contains comma separated format.
/markdown
Contains mark down format.
/mindmaps
Contains HTML mind maps best viewed in Google Chrome
Owner
Contributors
Categories
NetworkingData CenterProducts
Catalyst CenterProgramming Languages
License
Code Exchange Community
Get help, share code, and collaborate with other developers in the Code Exchange community.View Community