junipernetworks.junos.junos_vlans – VLANs resource module

Note

This plugin is part of the junipernetworks.junos collection.

To install it use: ansible-galaxy collection install junipernetworks.junos.

To use it in a playbook, specify: junipernetworks.junos.junos_vlans.

New in version 1.0.0: of junipernetworks.junos

Synopsis

  • This module creates and manages VLAN configurations on Junos OS.

Requirements

The below requirements are needed on the host that executes this module.

  • ncclient (>=v0.6.4)

Parameters

Parameter Choices/Defaults Comments
config
list / elements=dictionary
A dictionary of Vlan options
description
string
Text description of VLANs
name
string / required
Name of VLAN.
vlan_id
integer
IEEE 802.1q VLAN identifier for VLAN (1..4094).
running_config
string
This option is used only with state parsed.
The value of this option should be the output received from the Junos device by executing the command show vlans.
The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result
state
string
    Choices:
  • merged ←
  • replaced
  • overridden
  • deleted
  • gathered
  • parsed
  • rendered
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 Junos OS 18.4R1

  • This module works with connection netconf. See the Junos OS Platform Options.

Examples

# Using merged
#############

# Before State
# ------------
#
# admin# show vlans
# vlan-2 {
#     vlan-id 2;
# }
# vlan-3 {
#     vlan-id 3;
# }

- name: Merge JUNOS vlan
  junipernetworks.junos.junos_vlans:
    config:
    - name: vlan-1
      vlan-id: 1
  state: merged
- name: Replace JUNOS vlan
  junipernetworks.junos.junos_vlans:
    config:
    - name: vlan-1
      vlan-id: 10
    - name: vlan-3
      vlan-id: 30
  state: replaced
- name: Override JUNOS vlan
  junipernetworks.junos.junos_vlans:
    config:
    - name: vlan-4
      vlan-id: 100
    - name: vlan-2
      vlan-id: 200
  state: overridden
- name: Delete JUNOS vlan
  junipernetworks.junos.junos_vlans:
    config:
    - name: vlan-1
  state: deleted

Return Values

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

Key Returned Description
after
string
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
string
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.
commands
list / elements=string
always
The set of commands pushed to the remote device.

Sample:
['xml 1', 'xml 2', 'xml 3']


Authors

  • Daniel Mellado (@dmellado)