From bda9c61fcb69a3640b669d9afc751cf26f93717a Mon Sep 17 00:00:00 2001 From: Pierre Riteau Date: Thu, 30 Jul 2026 13:15:46 +0200 Subject: [PATCH] arista-switch: Fix switch interface configuration The arista-switch role was failing to apply switch interface configuration with an error such as: fatal: [arista-switch]: FAILED! => changed: false data: |- description ceph1 % Invalid input ARISTA-SWITCH(config-s-ansible_17)# msg: |- description ceph1 % Invalid input ARISTA-SWITCH(config-s-ansible_17)# This was caused by wrong indentation of the template, as described in the collection documentation [1]: The configuration lines in the source file should be similar to how it will appear if present in the running-configuration (live switch config) of the device including the indentation to ensure idempotency and correct diff. Arista EOS device config has 3 spaces indentation. Also remove the exit statement which appears unneeded. [1] https://docs.ansible.com/projects/ansible/latest/collections/arista/eos/eos_config_module.html Closes-Bug: #2162130 Change-Id: I278897607d7f6375594cfa6341e16caefbc32fd0 Signed-off-by: Pierre Riteau (cherry picked from commit 851aefc2fbbf673726f5e4314326490e822df455) --- ansible/roles/arista-switch/templates/arista-config.j2 | 10 ++++------ releasenotes/notes/bug-2162130-872debd77abe5ff5.yaml | 6 ++++++ 2 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 releasenotes/notes/bug-2162130-872debd77abe5ff5.yaml diff --git a/ansible/roles/arista-switch/templates/arista-config.j2 b/ansible/roles/arista-switch/templates/arista-config.j2 index 2d9254f8a..ddd91b5bb 100644 --- a/ansible/roles/arista-switch/templates/arista-config.j2 +++ b/ansible/roles/arista-switch/templates/arista-config.j2 @@ -4,14 +4,12 @@ {{ line }} {% endfor %} -{% for interface, config in -arista_switch_interface_config.items() %} - interface {{ interface }} +{% for interface, config in arista_switch_interface_config.items() %} +interface {{ interface }} {% if config.description is defined %} - description {{ config.description }} + description {{ config.description }} {% endif %} {% for line in config.config %} - {{ line }} + {{ line }} {% endfor %} - exit {% endfor %} diff --git a/releasenotes/notes/bug-2162130-872debd77abe5ff5.yaml b/releasenotes/notes/bug-2162130-872debd77abe5ff5.yaml new file mode 100644 index 000000000..fb2ec6241 --- /dev/null +++ b/releasenotes/notes/bug-2162130-872debd77abe5ff5.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Resolves an issue that prevented Arista switch interface configuration from + being applied. + `LP#2162130 `__