In this recipe, we will outline how to configure MPLS and some of the related protocols such as the Label Distribution Protocol (LDP) and the Resource Reservation Protocol (RSVP) on Juniper devices. We will outline how to generate the required MPLS configuration using Ansible and Jinja2 templates.
Configuring MPLS on Juniper devices
How to do it...
- Create a new Jinja2 file, mpls.j2, under the templates/junos directory with the following data:
$ cat roles/build_router_config/templates/junos/mpls.j2
protocols {
ldp {
{% for intf in p2p_ip[inventory_hostname]|sort(attribute='port') %}
interface {{intf.port}}.{{intf.vlan|default('0')}};
{% endfor %}
interface lo0.0;
}
rsvp...