cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

306
Views
0
Helpful
2
Replies
vladakoci
Beginner

Persuade Ansible to proceed with the command lines as they are

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

2 REPLIES 2
balaji.bandi
VIP Guru

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)

 

 

https://docs.ansible.com/ansible/latest/collections/cisco/ios/ios_acls_module.html#ansible-collections-cisco-ios-ios-acls-module

 

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

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.

Create
Recognize Your Peers
Content for Community-Ad