cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1545
Views
0
Helpful
16
Replies

ANSIBLE BACKUP ON CISCO

fmugambi
Spotlight
Spotlight

Hello Guys,

Below playbook is not working, kindly assist look into it and advise. Thanks.

fmugambi_0-1711445454310.png

Getting below error :-

fmugambi_1-1711445510456.png

What could I be doing wrong?

1 Accepted Solution

Accepted Solutions

Hello, the ansible_network_os should be:

ansible_network_os= ios

View solution in original post

16 Replies 16

Torbjørn
Spotlight
Spotlight

You need to remove the "host" parameter to your "DISPLAYING THE RUNNING-CONFIG" task.

The error message is saying that the parameter doesn't exist for the ios_command module. The "hosts" parameter is only allowed per play, not per task. If your goal is to run that task only for specific hosts, you can use a "when" statement to achieve this(see docs linked below).

You can read more about the ios_command module here, and these Ansible docs are also useful for controlling execution: Patterns: targeting hosts and groups  Conditionals based on variables 

Happy to help! Please mark as helpful/solution if applicable.
Get in touch: https://torbjorn.dev

I tried this, but does not seem to work.

DO you have a sample playbook, i can compare to, or an external resource I can lookup.

does it depend on ansible version, did they change anything, cause am running ansible 2.14.9

getting local module not found.

What output are you getting?

Happy to help! Please mark as helpful/solution if applicable.
Get in touch: https://torbjorn.dev

fmugambi
Spotlight
Spotlight

fmugambi_0-1711528873376.png

 

theVPNbloke
Level 1
Level 1

Hello! 2 things. Remove the 'Hosts' line from your 'Display The Running-Config' task as you've already defined the scope of the target hosts in the second line 'hosts: Core_Switch'

Also have you defined the OS in your variables file?  - 

ansible_network_os: ios 
 

what is the OS variable, been using cisco.ios.ios, but says module unsupported.

fmugambi_0-1711530738330.pngfmugambi_1-1711530751568.png

 

Can you post the inventory file?

Happy to help! Please mark as helpful/solution if applicable.
Get in touch: https://torbjorn.dev

[Core_Switch]
CORE

 

[Core_Switch:vars]
#ansible_connection=ansible.netcommon.network_cli
ansible_network_os=cisco.ios.ios
ansible_user=xxx
ansible_password= yyyy

Hello, the ansible_network_os should be:

ansible_network_os= ios

getting below: -

FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"ansible.legacy.ios_facts": {"failed": true, "invocation": {"module_args": {"available_network_resources": false, "gather_network_resources": null, "gather_subset": ["min"]}}, "msg": "ssh connection failed: Failed to authenticate public key: Access denied for 'keyboard interactive'. Authentication that can continue: publickey,keyboard-interactive,password"}}, "msg": "The following modules failed to execute: ansible.legacy.ios_facts\n"}

It seems that the password you have specified in your inventory is incorrect.

Happy to help! Please mark as helpful/solution if applicable.
Get in touch: https://torbjorn.dev

Review Cisco Networking for a $25 gift card