Unable to automatically determine host network os. Please manually configure ansible_network_os value for this host

I’m getting an unable to automatically determine host network os. Please manually configure ansible_network_os value for this host. I tried several ways to add ansible_network_os to the yml file but it didn’t work. I tried to use a var attribute in the yml file but it didn’t work. Please advise with an example. thanks.

  • my code!

@cyrus Hello.

The images do not seem to be attached properly.

Could you paste it back in as text?

I fixed the post for @cyrus, although I’d agree with using text as it’s searchable for other users :slight_smile:

1 Like

Have you tried setting the variable in your inventory? Build Your Inventory — Ansible Documentation

Here’s an example setting ansible_network_os for all hosts in a group called ios: IOS Platform Options — Ansible Documentation.

Or you could use the vars: keyword:

- hosts: all
  vars:
    ansible_network_os: cisco.ios.ios  # set for a play
  tasks:
    - ios_command:
        command: "{{ cmd }}"
      vars:
        ansible_network_os: cisco.ios.ios  # set for individual task

There are a some additional ways to set variables: Using Variables — Ansible Documentation.

1 Like