vRouter Management Automation with Ansible & NETCONF
vRouter Management Automation with Ansible & NETCONF
Blog Article
In a recent blog, we talked about provisioning for bare metal and VM platforms leveraging PXE and cloud-init. Once the vRouter is booted, it can be managed via its NETCONF API using automation tools such as Ansible, Python scripting or higher level orchestration tools.
In this blog post, I will present a practical example of Ansible usage with the vRouter NETCONF API. Ansible is an open-source software provisioning, configuration management, and application deployment tool written in Python. It supports the NETCONF protocol since version 2.4.0.
Preparation
Ansible is not a provisioning tool, it requires the machines it will configure to be booted and accessible on the network (NETCONF uses TCP port 830). You will find detailed instructions in 6WIND vRouter Getting Started Guide. I have booted 2 vRouter instances into 6WIND’s development network and I gave them DNS hostnames for clarity purposes.
Both machines have two physical network interfaces. One is used for management and the other one is used for production traffic. Mind that this is not a real world use case; I oversimplified it to make the example easier to grasp. Here is an overview of the setup:
Both management interfaces have already been configured automatically on boot by cloud-init and DHCP. The “production” interfaces have the same physical port identifier (pci-b0s4) and are named int0 and ext0 for vrouter1 and vrouter2 respectively. I want to use Ansible to configure the IP addresses of these “production” interfaces and the hostnames of both machines.
To avoid messing up my system packages, I chose to install Ansible into a python virtualenv. In order to support executing arbitrary NETCONF RPCs, Ansible version greater than 2.7.10 along with the additional ncclient and jxmlease python libraries are required.
Read More