junos_interfaces – Manages interface attributes of Juniper Junos OS network devices
New in version 2.9.
Synopsis
- This module manages the interfaces on Juniper Junos OS network devices.
 
Requirements
The below requirements are needed on the host that executes this module.
- ncclient (>=v0.6.4)
 
Parameters
| Parameter | Choices/Defaults | Comments | ||
|---|---|---|---|---|
|   config    list    |    The provided configuration   |  |||
|   description    string    |    Interface description.   |  |||
|   duplex    string    |   
  |    Interface link status. Applicable for Ethernet interfaces only, either in half duplex, full duplex or in automatic state which negotiates the duplex automatically.   |  ||
|   enabled    boolean    |   
  |    Administrative state of the interface.  Set the value to   true to administratively enabled the interface or false to disable it. |  ||
|   hold_time    dictionary    |    The hold time for given interface name.   |  |||
|   down    integer    |    The link down hold time in milliseconds.   |  |||
|   up    integer    |    The link up hold time in milliseconds.   |  |||
|   mtu    integer    |    MTU for a specific interface.  Applicable for Ethernet interfaces only.   |  |||
|   name    string / required    |    Full name of interface, e.g. ge-0/0/0.   |  |||
|   speed    integer    |    Interface link speed. Applicable for Ethernet interfaces only.   |  |||
|   state    string    |   
  |    The state of the configuration after module completion   |  ||
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:
| Key | Returned | Description | 
|---|---|---|
|   after    list    |  when changed |   The configuration as structured data after module completion.  Sample:  The configuration returned will always be in the same format of the parameters above.   |  
|   before    list    |  always |   The configuration as structured data prior to module invocation.  Sample:  The configuration returned will always be in the same format of the parameters above.   |  
|   xml    list    |  always |   The set of xml rpc payload pushed to the remote device.  Sample:  ['xml 1', 'xml 2', 'xml 3']   |  
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.
    © 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
    https://docs.ansible.com/ansible/2.9/modules/junos_interfaces_module.html