# how to obtain ip info

**URL:** <https://forum.ansible.com/t/how-to-obtain-ip-info/30244>\
**Category:** Ansible Project\
**Created:** [May 2, 2019, 7:14am UTC](https://forum.ansible.com/t/how-to-obtain-ip-info/30244 "2019-05-02T07:14:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lander7500](https://avatars.discourse-cdn.com/v4/letter/l/ecae2f/32.png) [@lander7500](https://forum.ansible.com/u/lander7500)\
**Post date:** [May 2, 2019, 7:14am UTC](https://forum.ansible.com/t/how-to-obtain-ip-info/30244/1 "2019-05-02T07:14:06Z")

</div>

I need ip, gateway and netmask info

---

<div class="post-metadata">

**Author:** ![Raghavendra\_Rao](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@Raghavendra\_Rao](https://forum.ansible.com/u/Raghavendra_Rao)\
**Post date:** [May 2, 2019, 7:57am UTC](https://forum.ansible.com/t/how-to-obtain-ip-info/30244/2 "2019-05-02T07:57:40Z")

</div>

Use ansible facts. Read about them more in the documentation section.

---

<div class="post-metadata">

**Author:** ![lander7500](https://avatars.discourse-cdn.com/v4/letter/l/ecae2f/32.png) [@lander7500](https://forum.ansible.com/u/lander7500)\
**Post date:** [May 2, 2019, 8:47am UTC](https://forum.ansible.com/t/how-to-obtain-ip-info/30244/3 "2019-05-02T08:47:56Z")

</div>

Can you give me a documentation?

---

<div class="post-metadata">

**Author:** ![Stephen\_John\_Smoogen](https://avatars.discourse-cdn.com/v4/letter/s/ad7895/32.png) [@Stephen\_John\_Smoogen](https://forum.ansible.com/u/Stephen_John_Smoogen)\
**Post date:** [May 2, 2019, 11:50am UTC](https://forum.ansible.com/t/how-to-obtain-ip-info/30244/4 "2019-05-02T11:50:34Z")

</div>

> Can you give me a documentation?

[https://docs.ansible.com/ansible/latest/user\_guide/playbooks\_filters\_ipaddr.html](https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters_ipaddr.html)

[https://stackoverflow.com/questions/52291149/ansible-to-get-the-netmask-in-cidr](https://stackoverflow.com/questions/52291149/ansible-to-get-the-netmask-in-cidr)

[https://www.google.com/search?q=how+to+use+facts+in+ansible&oq=how+to+use+facts+in+ansible](https://www.google.com/search?q=how+to+use+facts+in+ansible&oq=how+to+use+facts+in+ansible)

[https://www.oreilly.com/library/view/ansible-up-and/9781491915318/ch04.html](https://www.oreilly.com/library/view/ansible-up-and/9781491915318/ch04.html)

---

<div class="post-metadata">

**Author:** ![Raghavendra\_Rao](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@Raghavendra\_Rao](https://forum.ansible.com/u/Raghavendra_Rao)\
**Post date:** [May 2, 2019, 11:51am UTC](https://forum.ansible.com/t/how-to-obtain-ip-info/30244/5 "2019-05-02T11:51:21Z")

</div>

[https://docs.ansible.com/ansible/latest/modules/setup\_module.html](https://docs.ansible.com/ansible/latest/modules/setup_module.html)

Also run this adhoc command to gather info about all your hosts at once, then check which variables can be used for IP related information:

#ansible all -m setup | less
