# determining network os type?

**URL:** <https://forum.ansible.com/t/determining-network-os-type/26940>\
**Category:** Ansible Project\
**Created:** [March 9, 2018, 5:47am UTC](https://forum.ansible.com/t/determining-network-os-type/26940 "2018-03-09T05:47:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarcG](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@MarcG](https://forum.ansible.com/u/MarcG)\
**Post date:** [March 9, 2018, 5:47am UTC](https://forum.ansible.com/t/determining-network-os-type/26940/1 "2018-03-09T05:47:08Z")

</div>

Hi,

There are various network modules for iOS,EOS, etc etc…

What I was wondering is there a way to determine a hosts base os type so that the correct network module can be called? I have seen some sites reference ‘ansible\_network\_os’

like below. However I am not sure is this is simple a variable that has been set manually of something ansible sets when initially connecting to a device?

```auto
eos_facts:
  when: ansible_network_os == 'eos'

- name: Gather facts (ops)
  ios_facts:
  when: ansible_network_os == 'ios'

- name: Gather facts (vyos)
  vyos_facts:

```

---

<div class="post-metadata">

**Author:** ![ganeshrn](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ganeshrn/32/1021_2.png) [@ganeshrn](https://forum.ansible.com/u/ganeshrn)\
**Post date:** [March 9, 2018, 6:21am UTC](https://forum.ansible.com/t/determining-network-os-type/26940/2 "2018-03-09T06:21:52Z")

</div>

ansible\_network\_os is a reserved variable and need to be set manually.  
More details can be found here [https://docs.ansible.com/ansible/devel/network/user\_guide/platform\_index.html](https://docs.ansible.com/ansible/devel/network/user_guide/platform_index.html)

Regards,  
Ganesh
