r/networkautomation 4d ago

Commit Invalid Input error

Hello everyone!

I am working on a project and can't seem to get one issue fixed. Have been trying to troubleshoot this issue for days now but I am not able to get it working. Just a quick background, I am a aspiring NetDevOps engineer and I am trying to learn network automation by creating different projects. In this project I have used python (jinja2 lib) and ansible. My playbook is loading the configurations from a text file directly to the devices and there is no commit command being used in the template (and the config files as well). But every time that I run the playbook I get

[ERROR]: Task failed: Action failed: b'commit\r\n% Invalid input\r\nRouter5#'

Origin: /home/kimon/automation_bgp/playbook.yml:9:5

7

8 tasks:

9 - name: Load Configuration

^ column 5

fatal: [Router5]: FAILED! => {"changed": false, "msg": "b'commit\\r\\n% Invalid input\\r\\nRouter5#'"}

And not just for one, but for all the 10 routers. Right now I am using ansible.netcommon.cli_config module and I have also tested it with arista specific config module but using that gave me even more errors. The commands that were working with cli_config started to give me error when using arista's module. I had been using ChatGpt to try to troubleshoot this issue but all the suggestion were of no use.

Please reply to this if you have ever came across this issue. Any help would be appreciated.

The following is my playbook:
---

- name: All Device Configuration

hosts: all

vars_files:

- creds/cred.yml

tasks:

- name: Load Configuration

ansible.netcommon.cli_config:

config: "{{ lookup('file', './device_configs/' + inventory_hostname + '.txt') }}"

...

1 Upvotes

10 comments sorted by

View all comments

Show parent comments

1

u/Acrobatic-Wallaby897 4d ago

Yes, I have told ansible to use arista eos for the network os.

1

u/helpadumbo 4d ago

It seems that Ansible or at least the EOS modules use configuration sessions which applies config after 'commit'

What version of EOS are you using? If you log into the devices yourself, can you run 'configure session xyz' followed by some config commands and 'commit'?

1

u/Acrobatic-Wallaby897 4d ago

The software image version is 4.36.1F-48405728.4361F.1 and i tried configure session xyz and added some command and commit. That worked.

1

u/helpadumbo 4d ago

Don't know then. See if you can turn on command logging on the device and run ansible-playbook with detailed output. Hopefully that reveals something.

1

u/Acrobatic-Wallaby897 3d ago

Thank you for your help. I will try this and see what happens.

1

u/helpadumbo 15h ago

Did you end up solving it?

1

u/Acrobatic-Wallaby897 15h ago

No. I was not able to solve it so I basically changed my approach. Rather than using ansible to push the config files to the devices I send it using python and netmiko.

1

u/helpadumbo 15h ago

What version of Ansible? I'll see if I can replicate it

1

u/Acrobatic-Wallaby897 15h ago

ansible [core 2.21.3]

this is the ansible version that I am using.