# Determine which network a host is on

**URL:** <https://forum.ansible.com/t/determine-which-network-a-host-is-on/28900>\
**Category:** Ansible Project\
**Created:** [October 30, 2018, 5:41pm UTC](https://forum.ansible.com/t/determine-which-network-a-host-is-on/28900 "2018-10-30T17:41:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Bidwell](https://avatars.discourse-cdn.com/v4/letter/c/da6949/32.png) [@Chris\_Bidwell](https://forum.ansible.com/u/Chris_Bidwell)\
**Post date:** [October 30, 2018, 5:41pm UTC](https://forum.ansible.com/t/determine-which-network-a-host-is-on/28900/1 "2018-10-30T17:41:28Z")

</div>

So I’ve got a playbook I’ve written where the config is different depending on the network it resides on.

How can I determine this and be able to save the network as a variable?

---

<div class="post-metadata">

**Author:** ![Foss\_Geek](https://avatars.discourse-cdn.com/v4/letter/f/df705f/32.png) [@Foss\_Geek](https://forum.ansible.com/u/Foss_Geek)\
**Post date:** [October 30, 2018, 6:05pm UTC](https://forum.ansible.com/t/determine-which-network-a-host-is-on/28900/2 "2018-10-30T18:05:15Z")

</div>

Did you get any chance to through setup module?

> **[Ansible collections | Ansible documentation](https://docs.ansible.com/collections.html)**

## [Synopsis](https://docs.ansible.com/ansible/latest/modules/setup_module.html#id1)- This module is automatically called by playbooks to gather useful variables about remote hosts that can be used in playbooks. It can also be executed directly by `/usr/bin/ansible` to check what variables are available to a host. Ansible provides many _facts_ about the system, automatically.
