New in version 2.9.
The below requirements are needed on the host that executes this module.
| 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 / required    |    IEEE 802.1q VLAN identifier for VLAN (1..4094).   |  ||
|   state    string    |   
  |    The state of the configuration after module completion.   |  |
Note
netconf. See the Junos OS Platform Options.# Using merged
#############
# Before State
# ------------
#
# admin# show vlans
# vlan-2 {
#     vlan-id 2;
# }
# vlan-3 {
#     vlan-id 3;
# }
- name: Merge JUNOS vlan
  junos_vlans:
    config:
      - name: vlan-1
        vlan-id: 1
  state: merged
# After State
# -----------
#
# admin# show vlans
# vlan-1 {
#     vlan-id 1;
# }
# vlan-2 {
#     vlan-id 2;
# }
# vlan-3 {
#     vlan-id 3;
# }
# Using replaced
################
# Before State
# ------------
#
# admin# show vlans
# vlan-1 {
#     vlan-id 1;
# }
# vlan-2 {
#     vlan-id 2;
# }
# vlan-3 {
#     vlan-id 3;
# }
- name: Replace JUNOS vlan
  junos_vlans:
    config:
      - name: vlan-1
        vlan-id: 10
      - name: vlan-3
        vlan-id: 30
  state: replaced
# After State
# -----------
#
# admin# show vlans
# vlan-1 {
#     vlan-id 10;
# }
# vlan-2 {
#     vlan-id 2;
# }
# vlan-3 {
#     vlan-id 30;
# }
# Using overridden
##################
# Before State
# ------------
#
# admin# show vlans
# vlan-1 {
#     vlan-id 1;
# }
# vlan-2 {
#     vlan-id 2;
# }
# vlan-3 {
#     vlan-id 3;
# }
- name: Override JUNOS vlan
  junos_vlans:
    config:
      - name: vlan-4
        vlan-id: 100
      - name: vlan-2
        vlan-id: 200
  state: overridden
# After State
# -----------
#
# admin# show vlans
# vlan-2 {
#     vlan-id 200;
# }
# vlan-4 {
#     vlan-id 100;
# }
#Using deleted
##############
# Before State
# ------------
#
# admin# show vlans
# vlan-1 {
#     vlan-id 1;
# }
# vlan-2 {
#     vlan-id 2;
# }
# vlan-3 {
#     vlan-id 3;
# }
- name: Delete JUNOS vlan
  junos_vlans:
    config:
      - name: vlan-1
  state: deleted
# After State
# -----------
#
# admin# show vlans
# vlan-2 {
#     vlan-id 2;
# }
# vlan-3 {
#     vlan-id 3;
# }
   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    |  always |   The set of commands pushed to the remote device.  Sample:  ['xml 1', 'xml 2', 'xml 3']   |  
More information about Red Hat’s support of this module is available from this Red Hat Knowledge Base article.
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_vlans_module.html