How to do it...

  1. Update the group_vars/all.yml YAML file to include the following data for all the point-to-point (P2P) and loopback interfaces in our sample network topology:
p2p_ip:
mxp01:
- {port: ge-0/0/0, ip: 10.1.1.2 , peer: mxpe01, pport: ge-0/0/0, peer_ip: 10.1.1.3}
- {port: ge-0/0/1, ip: 10.1.1.4 , peer: mxpe02, pport: ge-0/0/0, peer_ip: 10.1.1.5}
- {port: ge-0/0/3, ip: 10.1.1.0 , peer: mxp02, pport: ge-0/0/3, peer_ip: 10.1.1.1}
mxp02:
<-- Output Trimmed for brevity ------>
mxpe01:
<-- Output Trimmed for brevity ------>
mxpe02:
<-- Output Trimmed for brevity ------>
xrpe03:
<-- Output Trimmed for brevity ------>
lo_ip:
mxp01: 10.100.1.254/32
mxp02: 10.100.1.253/32
mxpe01: 10.100.1.1/32
mxpe02: 10.100.1.2/32
xrpe03: 10.100.1.3/32
  1. Update the pb_jnpr_basic_config.yml playbook with the following tasks to set up the interfaces on our Juniper devices:
- name: "Configure the Physical Interfaces"
junos_interface:
name: "{{ item.port }}"
enabled: true
description: "peer:{{item.peer}} remote_port:{{item.pport }}"
mtu: "{{ global.mtu | default(1500) }}"
with_items: "{{p2p_ip[inventory_hostname]}}"
tags: intf

- name: "Configure IP Addresses"
junos_l3_interface:
name: "{{ item.port }}"
ipv4: "{{ item.ip }}/{{ global.p2p_prefix }}"
state: present
with_items: "{{ p2p_ip[inventory_hostname] }}"
tags: intf