Network topology discovery with Ansible and Skydive
by Sylvain Afchain, 05/09/2018
Since Skydive already has a Python client library I thought it was “fun” to create an Ansible module leveraging it to add topology entities. In this blog post I will show how to use this module and how to use this module to provide real topology information.
Nodes and Links
The module is part of the Skydive repository, so the first thing is to prepare the Ansible environment by download the module in the proper place.
Now we have the module available, let’s write a really simple playbook creating two nodes, one will be a “Top of Rack” switch
and the other one will be a port. Of course we will create a link between them.
You can use the metadata dict to add any arbitrary information you want.
Once executed we’ll see the entities in the topology.
node1 and node2 can be either the ID of the nodes or a Gremlin expression.
The following playbook shows a mix of ID and a Gremlin expression to link the switch
port to a host interface.
This gives the following topology.
Ansible, Skydive and LLDP
Finally the following example will be a bit more concrete. It uses LLDP to retrieve physical topology information
and the Skydive module to inject them into the Skydive topology.
As we saw the Skydive module allows to leverage the
the Network Automation Ansible ecosystem.
The current Skydive module is a first version that surely needs to be improved. And, as usual, contributions are more than welcome :)