03-03-2022 02:55 AM
Hello,
I am relatively new to Ansible, need to use ios_config to make some changes on Cisco routers.
It works fine, however I am a bit struggling with embedded logic how Ansible process the changes.
For some reasons I need to do this in one block
"no ip access-list extended ACL1",
"ip access-list extended ACL1",
"remark # Automatically created on 20220303_1000 #",
some ACL rules
"no ip access-list extended ACL2",
"ip access-list extended ACL2",
"remark # Automatically created on 20220303_1000 #",
some ACL rules
Ansible because of embedded logic removes the second line
"remark # Automatically created on 20220303_1000 #",
I guess its internal logic thinks it is a duplicate.
I have more lines like these, the one above is just an example.
I am trying to persuade Ansible to proceed with the lines as they are ( without optimizing them )
using
match: none
replace: block
but it does not work as expected.
I do have these versions:
ansible-playbook 2.9.21
config file = /etc/ansible/ansible.cfg
configured module search path = ['/opt/autowan/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.6/site-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 3.6.15 (default, Sep 15 2021, 14:20:42) [GCC]
I cannot change the versions as this is used by some other users/systems for non-Cisco automation.
Does anyone know how to persuade Ansible to just proceed with the lines ( config them ) without trying
to optimize ?
Thank you, Vlad
03-03-2022 03:11 AM
check below example can help you : ( not sure remarks can not be same, you looking to change the date format then use a variable to insert remarks getting date information dynamically)
03-03-2022 07:39 AM
Thank you. Actually I have to use ios_config because there are some other commands, not related to ACLs.
I do not want to split config changes among ACL related and others.
In the meantime I installed Ansible 2.11.9 in virtual environment, running the same playbook and have the same result as with 2.9.21.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide