junos_vlans – Create and manage VLAN configurations on Junos OS¶
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 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
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;
# }
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¶
- Daniel Mellado (@danielmellado)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.