Open Random6554 opened 1 year ago
@Random6554 I'm not sure if it's an Ansible bug, because you're missing an exit
after:
ip access-list TESTACL6
10 permit tcp any any eq microsoft-ds
->
ip access-list TESTACL6
10 permit tcp any any eq microsoft-ds
exit
ACLs will be written into the config (session-config, running-config) after you exit the ACL edit mode. After the exit
the show session-config diffs
will return the expected result. That's normal behavior in Arista EOS (and that differs to Cisco IOS). That's an EOS feature, so you're able to complete the changes of your ACL before it will be written once into the config.
The exit
command is optional if you enter a command to change the config node, e.g. you're in ip access-list TESTACL5
and you're entering ip access-list TESTACL6
. Internally the commands exit
and afterwards ip access-list TESTACL6
will be executed. At the end it's good practice to always execute an exit
so the config node will be written into the config.
This would be a good optimisation if not a bug, I've been running the fix in production for a few weeks now.
Adding an exit at the end of ACL(s) file is less desirable as it does not show in the running config or session config.
This creates an anti-pattern as the person updating or writing the ACL file has to remember to add an explicit exit.
SUMMARY
When diffing ACLs using the session configuration such as ansible_XXXXXXXX the diff is not representative of the change it will make. The module is still in the ACL sub command and that change is written to the session config after the module exits. The module is issuing the
show session-config diffs
command while still in ACL sub-command, hence why the last command (TESTACL6) is does not appear in the diff.https://www.arista.com/en/um-eos/eos-acls-and-route-maps#xx1148961 Creating and Modifying Lists
ISSUE TYPE
COMPONENT NAME
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
The diff should show TESTACL6 as a change/diff
ACTUAL RESULTS
Potential Fix
https://github.com/ansible-collections/arista.eos/blob/8fc41fc33a0cc05c034fd85bb1cb2ca253cb9078/plugins/cliconf/eos.py#L251
Add a return to the config session before sending the diff command. This ensures sub-commands are written to the session config before the diff command is sent.
self.send_command("configure session %s" % session)