junos_l3_interfaces – Manage Layer 3 interface on Juniper JUNOS devices¶
New in version 2.9.
Synopsis¶
This module provides declarative management of a Layer 3 interface on Juniper JUNOS devices
Requirements¶
The below requirements are needed on the host that executes this module.
ncclient (>=v0.6.4)
Parameters¶
Notes¶
Note
This module requires the netconf system service be enabled on the device being managed.
This module works with connection
netconf
. See the Junos OS Platform Options.Tested against JunOS v18.4R1
Examples¶
# Using deleted
# Before state:
# -------------
#
# admin# show interfaces
# ge-0/0/1 {
# description "L3 interface";
# unit 0 {
# family inet {
# address 10.200.16.10/24;
# }
# }
# }
# ge-0/0/2 {
# description "non L3 interface";
# unit 0 {
# family ethernet-switching {
# interface-mode access;
# vlan {
# members 2;
# }
# }
# }
# }
- name: Delete JUNOS L3 logical interface
junos_l3_interfaces:
config:
- name: ge-0/0/1
- name: ge-0/0/2
state: deleted
# After state:
# ------------
#
# admin# show interfaces
# ge-0/0/1 {
# description "deleted L3 interface";
# }
# ge-0/0/2 {
# description "non L3 interface";
# unit 0 {
# family ethernet-switching {
# interface-mode access;
# vlan {
# members 2;
# }
# }
# }
# }
# Using merged
# Before state
# ------------
#
# admin# show interfaces
# ge-0/0/1 {
# description "L3 interface";
# unit 0 {
# family inet {
# address 10.200.16.10/24;
# }
# }
# }
# ge-0/0/2 {
# description "non configured interface";
# unit 0;
# }
- name: Merge provided configuration with device configuration (default operation is merge)
junos_l3_interfaces:
config:
- name: ge-0/0/1
ipv4:
- address: 192.168.1.10/24
ipv6:
- address: 8d8d:8d01::1/64
- name: ge-0/0/2
ipv4:
- address: dhcp
state: merged
# After state:
# ------------
#
# admin# show interfaces
# ge-0/0/1 {
# description "L3 interface";
# unit 0 {
# family inet {
# address 10.200.16.10/24;
# address 192.168.1.10/24;
# }
# family inet6 {
# address 8d8d:8d01::1/64;
# }
# }
# }
# ge-0/0/2 {
# description "L3 interface with dhcp";
# unit 0 {
# family inet {
# dhcp;
# }
# }
# }
# Using overridden
# Before state
# ------------
#
# admin# show interfaces
# ge-0/0/1 {
# description "L3 interface";
# unit 0 {
# family inet {
# address 10.200.16.10/24;
# }
# }
# }
# ge-0/0/2 {
# description "L3 interface with dhcp";
# unit 0 {
# family inet {
# dhcp;
# }
# }
# }
# ge-0/0/3 {
# description "another L3 interface";
# unit 0 {
# family inet {
# address 192.168.1.10/24;
# }
# }
# }
- name: Override provided configuration with device configuration
junos_l3_interfaces:
config:
- name: ge-0/0/1
ipv4:
- address: 192.168.1.10/24
ipv6:
- address: 8d8d:8d01::1/64
- name: ge-0/0/2
ipv6:
- address: 2001:db8:3000::/64
state: overridden
# After state:
# ------------
#
# admin# show interfaces
# ge-0/0/1 {
# description "L3 interface";
# unit 0 {
# family inet {
# address 192.168.1.10/24;
# }
# family inet6 {
# address 8d8d:8d01::1/64;
# }
# }
# }
# ge-0/0/2 {
# description "L3 interface with ipv6";
# unit 0 {
# family inet6 {
# address 2001:db8:3000::/64;
# }
# }
# }
# ge-0/0/3 {
# description "overridden L3 interface";
# unit 0;
# }
# Using replaced
# Before state
# ------------
#
# admin# show interfaces
# ge-0/0/1 {
# description "L3 interface";
# unit 0 {
# family inet {
# address 10.200.16.10/24;
# }
# }
# }
# ge-0/0/2 {
# description "non configured interface";
# unit 0;
# }
# ge-0/0/3 {
# description "another L3 interface";
# unit 0 {
# family inet {
# address 192.168.1.10/24;
# }
# }
# }
- name: Replace provided configuration with device configuration
junos_l3_interfaces:
config:
- name: ge-0/0/1
ipv4:
- address: 192.168.1.10/24
ipv6:
- address: 8d8d:8d01::1/64
- name: ge-0/0/2
ipv4:
- address: dhcp
state: replaced
# After state:
# ------------
#
# admin# show interfaces
# ge-0/0/1 {
# description "L3 interface";
# unit 0 {
# family inet {
# address 192.168.1.10/24;
# }
# family inet6 {
# address 8d8d:8d01::1/64;
# }
# }
# }
# ge-0/0/2 {
# description "L3 interface with dhcp";
# unit 0 {
# family inet {
# dhcp;
# }
# }
# }
# ge-0/0/3 {
# description "another L3 interface";
# unit 0 {
# family inet {
# address 192.168.1.10/24;
# }
# }
# }
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Status¶
This module is not guaranteed to have a backwards compatible interface. [preview]
This module is maintained by the Ansible Network Team. [network]
Red Hat Support¶
More information about Red Hat’s support of this module is available from this Red Hat Knowledge Base article.
Authors¶
Daniel Mellado (@dmellado)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.