03-26-2024 02:32 AM
Hello Guys,
Below playbook is not working, kindly assist look into it and advise. Thanks.
Getting below error :-
What could I be doing wrong?
Solved! Go to Solution.
03-27-2024 05:34 AM
03-26-2024 03:17 AM - edited 03-26-2024 03:25 AM
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
03-26-2024 06:08 AM
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.
03-26-2024 06:25 AM
Hello,
below is a link to a tutorial:
https://www.rogerperkin.co.uk/network-automation/ansible/ansible-tutorial-network-engineers/
03-26-2024 06:37 AM
does it depend on ansible version, did they change anything, cause am running ansible 2.14.9
getting local module not found.
03-26-2024 07:48 AM
What output are you getting?
03-27-2024 01:41 AM
03-27-2024 01:56 AM - edited 03-27-2024 01:57 AM
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? -
03-27-2024 02:04 AM
what is the OS variable, been using cisco.ios.ios, but says module unsupported.
03-27-2024 02:12 AM
03-27-2024 02:42 AM
Can you post the inventory file?
03-27-2024 05:18 AM
[Core_Switch]
CORE
[Core_Switch:vars]
#ansible_connection=ansible.netcommon.network_cli
ansible_network_os=cisco.ios.ios
ansible_user=xxx
ansible_password= yyyy
03-27-2024 05:34 AM
Hello, the ansible_network_os should be:
ansible_network_os= ios
03-28-2024 02:03 AM
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"}
03-28-2024 02:18 AM
It seems that the password you have specified in your inventory is incorrect.
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