05-15-2024 04:32 AM
Hi All, This is my first time writing an ansible playbook. Please can anyone help me with the following error. I'm just trying to run a basic show ver to a cisco ios switch. ansible-playbook new.yml PLAY [cisco] *********************************************************************************************************************************************** TASK [show version] **************************************************************************************************************************************** fatal: [mgmtsw1]: FAILED! => {"msg": "Unable to automatically determine host network os. Please manually configure ansible_network_os value for this host"} PLAY RECAP ************************************************************************************************************************************************* mgmtsw1 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 Here is my playbook. please forgive the lack of spacing here this is indented correctly in the actual playbook - hosts : cisco gather_facts : false connection : local tasks : - name : show version cisco.ios.ios_command : Commands : show version and inventory file: [cisco:vars] ansbile_network_os=ios ansible_connection=network_cli [cisco] mgmtsw1 ansible_host=1.1.1.1 Thanks
05-15-2024 04:49 AM
Hey @matthewoncisco you error message "Unable to automatically determine host network os" means that Ansible cannot automatically detect the operating system of your Cisco device. You can try adding the ansible_network_os variable directly in your playbook, like this:
- hosts: cisco
gather_facts: false
connection: local
vars:
ansible_network_os: ios
tasks:
- name: show version
cisco.ios.ios_command:
commands:
- show version
If you share your playbook/inv file this will help in case you have other issues such as.
Edit: i saw you have In your inventory file, you have a typo in ansbile_network_os
. It should be ansible_network_os
.
04-23-2025 01:01 AM
Check the ios release and notes of the ansible collection
01-03-2023 11:38 AM
Hi All,
This is my first time writing an ansible playbook. Please can anyone help me with the following error. I'm just trying to run a basic show ver to a cisco ios switch.
ansible-playbook new.yml
PLAY [cisco] ***********************************************************************************************************************************************
TASK [show version] ****************************************************************************************************************************************
fatal: [mgmtsw1]: FAILED! => {"msg": "Unable to automatically determine host network os. Please manually configure ansible_network_os value for this host"}
PLAY RECAP *************************************************************************************************************************************************
mgmtsw1 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Here is my playbook. please forgive the lack of spacing here this is indented correctly in the actual playbook
[cisco:vars]
ansbile_network_os=ios
ansible_connection=network_cli
[cisco]
mgmtsw1 ansible_host=1.1.1.1
Thanks
01-03-2023 12:28 PM
ignore - problem resolved.
thanks
11-06-2023 12:00 PM
what was the fix?
02-02-2024 08:19 AM
Are we good to close this?
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