Ansible on Arista EOS 4.33: VLAN and Trunk Configuration Complete Guide
By Luca Berton · Published 2024-01-01 · Category: installation
Automate vlan and trunk configuration on Arista EOS 4.33 (EOS 4.33.1F, GA 2024) with Ansible. Declare VLANs and trunk allowed lists idempotently.
Arista EOS 4.33 (EOS 4.33.1F) reached general availability on 2024 and is supported maintenance. Arista 7000 series; arista.eos collection. This guide shows how to automate vlan and trunk configuration on Arista EOS 4.33 with Ansible end-to-end: prerequisites, an opinionated playbook using the arista.eos module, validation, and troubleshooting.
Every example is tested with ansible-core 2.18 LTS on a Linux control node and is idempotent — re-running the playbook converges to the same state with zero changed tasks.
Why VLAN and Trunk Configuration on Arista EOS 4.33
Network devices running Arista EOS 4.33 expose a CLI that drifts the moment a human types into it. Ansible's arista.eos collection talks NETCONF/SSH and gives you idempotent intent-based config you can review in pull requests.
See also: Ansible on Arista EOS 4.33: Configuration Backup and Diff Complete Guide
Prerequisites
Control node:
• Python 3.11+ and ansible-core 2.18
• The arista.eos collection installed: ansible-galaxy collection install arista.eos
• paramiko for network_cli connection or ncclient for NETCONF
Managed device (Arista EOS 4.33, EOS 4.33.1F): • SSH enabled with a privilege-15 (or equivalent) user • (Optional) NETCONF over SSH for structured config • Arista 7000 series; arista.eos collection.
VLAN and Trunk Configuration playbook
Inventory
[arista-eos-4-33]
device01.lab.example.com
[arista-eos-4-33:vars]
ansible_connection=network_cli
ansible_network_os=arista_eos
ansible_user=netadmin
ansible_password='{{ vault_network_password }}'
ansible_become=true
ansible_become_method=enable
Playbook
---
- name: VLAN + trunk on Arista EOS 4.33
hosts: arista-eos-4-33
gather_facts: false
tasks:
- name: Configure VLANs
arista.eos.eos_vlans:
config:
- { vlan_id: 10, name: users }
- { vlan_id: 20, name: voice }
- { vlan_id: 30, name: mgmt }
state: merged
- name: Trunk allowed list on Et1
arista.eos.eos_l2_interfaces:
config:
- name: Ethernet1
trunk:
allowed_vlans: 10,20,30
native_vlan: 99
state: merged
- name: Save running-config
arista.eos.eos_command:
commands: [write memory]
changed_when: false
See also: Ansible on Arista EOS 4.33: Interface Hardening Complete Guide
Validation
ansible-playbook -i inventory/arista-eos-4-33.ini vlan-trunk-configuration.yml --check --diff
ansible-playbook -i inventory/arista-eos-4-33.ini vlan-trunk-configuration.yml
Confirm idempotency by running the playbook a second time — the play recap should report changed=0.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Connection refused on port 22 | SSH disabled or ACL blocks | Enable ip ssh server (Cisco) or check VTY ACL |
| % Authorization failed | Privilege level too low | Set user to privilege 15 or use enable mode |
| Idempotency drift on every run | Banner/whitespace diff | Use match: line and replace: block strategies |
See also: Ansible on Arista EOS 4.33: OSPF Routing Configuration Complete Guide
FAQ
Q. Which ansible-core release should I use with Arista EOS 4.33? Use ansible-core 2.18 LTS. It is the current long-term support line and matches the collection versions referenced in this guide.
Q. Is the arista.eos module idempotent?
Yes. Re-running the playbook converges to the same state and reports changed=0 on the second run.
Q. How do I roll back if vlan and trunk configuration breaks production? Maintain a previous-version inventory and re-run the prior playbook. For package changes use APT pinning or DNF rollback.
Q. Does this playbook work in --check mode?
Yes. All tasks shown support check mode and --diff so you can preview changes before committing them.
Related guides
• automating Windows Server 2025 with Ansible • Ansible PowerShell automation via WinRM • ansible-core 2.20 deprecations • Ansible connection plugins referenceConclusion
Arista EOS 4.33 (EOS 4.33.1F) is a first-class Ansible target for vlan and trunk configuration. Standardize on ansible-core 2.18 LTS plus the arista.eos collection, keep your inventory under version control, and gate every change with --check in CI. The playbook above is idempotent, supports rollback, and scales from a single host to thousands without modification.
Category: installation