junos_interfaces – Manages interface attributes of Juniper Junos OS network devices¶
New in version 2.9.
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 remote device being managed.
- Tested against vSRX JUNOS version 18.4R1.
- This module works with connection
netconf
. See the Junos OS Platform Options.
Examples¶
# Using deleted
# Before state:
# -------------
# user@junos01# show interfaces
# ge-0/0/1 {
# description "Configured by Ansible-1";
# speed 1g;
# mtu 1800
# }
# ge-0/0/2 {
# description "Configured by Ansible-2";
# ether-options {
# auto-negotiation;
# }
# }
- name: "Delete given options for the interface (Note: This won't delete the interface itself if any other values are configured for interface)"
junos_interfaces:
config:
- name: ge-0/0/1
description: 'Configured by Ansible-1'
speed: 1g
mtu: 1800
- name: ge-0/0/2
description: 'Configured by Ansible -2'
state: deleted
# After state:
# ------------
# user@junos01# show interfaces
# ge-0/0/2 {
# ether-options {
# auto-negotiation;
# }
# }
# Using merged
# Before state:
# -------------
# user@junos01# show interfaces
# ge-0/0/1 {
# description "test interface";
# speed 1g;
# }
- name: "Merge provided configuration with device configuration (default operation is merge)"
junos_interfaces:
config:
- name: ge-0/0/1
description: 'Configured by Ansible-1'
enabled: True
mtu: 1800
- name: ge-0/0/2
description: 'Configured by Ansible-2'
enabled: False
state: merged
# After state:
# ------------
# user@junos01# show interfaces
# ge-0/0/1 {
# description "Configured by Ansible-1";
# speed 1g;
# mtu 1800
# }
# ge-0/0/2 {
# disable;
# description "Configured by Ansible-2";
# }
# Using overridden
# Before state:
# -------------
# user@junos01# show interfaces
# ge-0/0/1 {
# description "Configured by Ansible-1";
# speed 1g;
# mtu 1800
# }
# ge-0/0/2 {
# disable;
# description "Configured by Ansible-2";
# ether-options {
# auto-negotiation;
# }
# }
# ge-0/0/11 {
# description "Configured by Ansible-11";
# }
- name: "Override device configuration of all interfaces with provided configuration"
junos_interfaces:
config:
- name: ge-0/0/2
description: 'Configured by Ansible-2'
enabled: False
mtu: 2800
- name: ge-0/0/3
description: 'Configured by Ansible-3'
state: overridden
# After state:
# ------------
# user@junos01# show interfaces
# ge-0/0/2 {
# disable;
# description "Configured by Ansible-2";
# mtu 2800
# }
# ge-0/0/3 {
# description "Configured by Ansible-3";
# }
# Using replaced
# Before state:
# -------------
# user@junos01# show interfaces
# ge-0/0/1 {
# description "Configured by Ansible-1";
# speed 1g;
# mtu 1800
# }
# ge-0/0/2 {
# disable;
# mtu 1800;
# speed 1g;
# description "Configured by Ansible-2";
# ether-options {
# auto-negotiation;
# }
# }
# ge-0/0/11 {
# description "Configured by Ansible-11";
# }
- name: "Replaces device configuration of listed interfaces with provided configuration"
junos_interfaces:
config:
- name: ge-0/0/2
description: 'Configured by Ansible-2'
enabled: False
mtu: 2800
- name: ge-0/0/3
description: 'Configured by Ansible-3'
state: replaced
# After state:
# ------------
# user@junos01# show interfaces
# ge-0/0/1 {
# description "Configured by Ansible-1";
# speed 1g;
# mtu 1800
# }
# ge-0/0/2 {
# disable;
# description "Configured by Ansible-2";
# mtu 2800
# }
# ge-0/0/3 {
# description "Configured by Ansible-3";
# }
# ge-0/0/11 {
# description "Configured by Ansible-11";
# }
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¶
- Ganesh Nalawade (@ganeshrn)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.