Skip to content

Latest commit

 

History

History
84 lines (68 loc) · 1.6 KB

arista_vlan_replace.md

File metadata and controls

84 lines (68 loc) · 1.6 KB

Arista VLAN replace using eos_vlans

This documentation is to support the arista_vlan_replace.yml Ansible Playbook. The arista_vlan_replace.yml Ansible Playbook can be found in the playbooks directory of this Ansible Collection

Execute the Ansible Playbook

Use the ansible-playbook command to execute the playbook:

ansible-playbook arista_vlan_replace.yml

Explanation of replaced versus merge

Why would I use this versus a merge? The major difference between a merge and a replace is that a merge just makes sure the commands are present that are represented within your data model whereas the replaced parameter will make your resource match the data model. Let's look at the eos_vlans module to see what it considers as part of the vlans resource.

There are three parameters currently for the vlans resource: name state (active or suspend) vlan_id (range between 1-4094)

So let's look at an example

Data model Existing Arista Configuration
- name: desktops
 vlan_id: 200
vlan 200
   state suspend
!

This is how merged will compare to replace

merged replaced
vlan 200
   name desktops
   state suspend
!
vlan 20,200
   name desktops
!

The replaced conforms the VLAN resource to the data model whereas the merged just makes the data model configuration exists on the box. To think of this another way, the replace parameter is aware of commands that shouldn’t be there as well as what should.