cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
387
Views
0
Helpful
3
Replies

ACL push to IOS through Ansible

dheerajoz30
Level 1
Level 1

Hi Guys I am pushing the following config to the cisco routers, thera re about 500 of them, but script is getting failed/

---
- name: Create ACL
hosts: routers
gather_facts: false
connection: local

vars:
cli:
username: "{{ hdn_user_rw }}"
password: "{{ hdn_pass_rw }}"

tasks:

- name: Push config
ios_config:
provider: "{{ cli }}"
authorize: yes
lines:
- permit 10.253.68.64 0.0.0.62
Parents: ip access-list standard TEST
before: no ip access-list standard TEST
match: none

Error message that I get is

 


Unsupported parameters for (ios_config) module: Parents Supported parameters include: after,auth_pass,authorize,backup,before,defaults,diff_against,diff_ignore_lines,force,host,intended_config,lines,match,multiline_delimiter,parents,password,port,provider,replace,running_config,save,save_when,src,ssh_keyfile,timeout,username
to retry, use: --limit @/opt/ansible/dev/Dheeraj/Splunk3.retry

PLAY RECAP *****************************************************************************************************************************************************************************************************************************************************
WAGGJLC-NRT001 : ok=0 changed=0 unreachable=0 failed=1

[htech@virtapp-sis002 Dheeraj]$

 

Appreciate if could help

 

 

3 Replies 3

balaji.bandi
Hall of Fame
Hall of Fame

what ansible version you using, check from the Linux first you able to connect normally using SSH command to confirm is the device reachable and working.

I used below example to test single device when i was testing my Lab it works as expected : (what kind of router and model you using, do you see any logs on the router while ansible connecting time ?)

https://docs.ansible.com/archive/ansible/2.5/modules/ios_config_module.html

BB

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

How to Ask The Cisco Community for Help

@dheerajoz30  based on the error you see, i would indicate that the parents parameter is not supported by the ios_config module. The parameter is used to specify the parent configuration section where the changes should be applied. From what i recall, the ios_config module only supports applying changes to the global configuration section. https://docs.ansible.com/ansible/latest/collections/cisco/ios/ios_config_module.html

To fix this issue, you can remove the parents parameter from the task. The changes should then be applied to the global configuration section, which should resolve error issue you see.

Hope this helps.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Marcel Zehnder
Spotlight
Spotlight

@dheerajoz30  also check your inventory, it should look something like this:

routers:
  hosts:
    router1.xyz.com:
    router2.xyz.com:
  vars:
      ansible_connection: ansible.netcommon.network_cli
      ansible_network_os: cisco.ios.ios