W3cubDocs

/Ansible

junos_interface - Manage Interface on Juniper JUNOS network devices

New in version 2.4.

Synopsis

  • This module provides declarative management of Interfaces on Juniper JUNOS network devices.

Requirements (on host that executes module)

  • ncclient (>=v0.5.2)

Options

parameter required default choices comments
active
no True
  • True
  • False
Specifies whether or not the configuration is active or deactivated
aggregate
no
List of Interfaces definitions.
delay
no 10
Time in seconds to wait before checking for the operational state on remote device. This wait is applicable for operational state argument which are state with values up/down, tx_rate and rx_rate.
description
no
Description of Interface.
duplex
no auto
  • full
  • half
  • auto
Interface link status.
enabled
no
Configure interface link status.
mtu
no
Maximum size of transmit packet.
name
yes
Name of the Interface.
rx_rate
no
Receiver rate in bits per second (bps).
speed
no
Interface link speed.
state
no present
  • present
  • absent
  • up
  • down
State of the Interface configuration, up idicates present and operationally up and down indicates present and operationally down
tx_rate
no
Transmit rate in bits per second (bps).

Examples

- name: configure interface
  junos_interface:
    name: ge-0/0/1
    description: test-interface

- name: remove interface
  junos_interface:
    name: ge-0/0/1
    state: absent

- name: make interface down
  junos_interface:
    name: ge-0/0/1
    enabled: False

- name: make interface up
  junos_interface:
    name: ge-0/0/1
    enabled: True

- name: Deactivate interface config
  junos_interface:
    name: ge-0/0/1
    state: present
    active: False

- name: Activate interface config
  net_interface:
    name: ge-0/0/1
    state: present
    active: True

- name: Configure interface speed, mtu, duplex
  junos_interface:
    name: ge-0/0/1
    state: present
    speed: 1g
    mtu: 256
    duplex: full

- name: Create interface using aggregate
  junos_interface:
    aggregate:
      - name: ge-0/0/1
        description: test-interface-1
      - name: ge-0/0/2
        description: test-interface-2
    speed: 1g
    duplex: full
    mtu: 512

- name: Delete interface using aggregate
  junos_interface:
    aggregate:
      - name: ge-0/0/1
      - name: ge-0/0/2
    state: absent

- name: Check intent arguments
  junos_interface:
    name: "{{ name }}"
    state: up
    tx_rate: ge(0)
    rx_rate: le(0)

- name: Config + intent
  junos_interface:
    name: "{{ name }}"
    enabled: False
    state: down

Return Values

Common return values are documented here Return Values, the following are the fields unique to this module:

name description returned type sample
diff.prepared
Configuration difference before and after applying change.
when configuration is changed and diff option is enabled. string [edit interfaces] + ge-0/0/1 { + description test-interface; + }

Notes

Note

  • This module requires the netconf system service be enabled on the remote device being managed.
  • Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4.

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Maintenance Info

For more information about Red Hat’s this support of this module, please refer to this knowledge base article<https://access.redhat.com/articles/rhel-top-support-policies>

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

© 2012–2017 Michael DeHaan
© 2017 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/junos_interface_module.html