# NMAP in Ansible

**URL:** <https://forum.ansible.com/t/nmap-in-ansible/37340>\
**Category:** Ansible Project\
**Created:** [November 14, 2022, 8:57am UTC](https://forum.ansible.com/t/nmap-in-ansible/37340 "2022-11-14T08:57:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manish\_Chawda](https://avatars.discourse-cdn.com/v4/letter/m/46a35a/32.png) [@Manish\_Chawda](https://forum.ansible.com/u/Manish_Chawda)\
**Post date:** [November 14, 2022, 8:57am UTC](https://forum.ansible.com/t/nmap-in-ansible/37340/1 "2022-11-14T08:57:50Z")

</div>

Hi,

Anyone is aware as to how to use nmap plugin to populate inventory dynamically from local premises ?

Manish

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [November 14, 2022, 3:40pm UTC](https://forum.ansible.com/t/nmap-in-ansible/37340/2 "2022-11-14T15:40:18Z")

</div>

The plugin itself has an example config, you might just need to change  
the IP ranges involved.

[https://docs.ansible.com/ansible/latest/collections/community/general/nmap\_inventory.html#examples](https://docs.ansible.com/ansible/latest/collections/community/general/nmap_inventory.html#examples)

---

<div class="post-metadata">

**Author:** ![Manish\_Chawda](https://avatars.discourse-cdn.com/v4/letter/m/46a35a/32.png) [@Manish\_Chawda](https://forum.ansible.com/u/Manish_Chawda)\
**Post date:** [November 15, 2022, 8:36am UTC](https://forum.ansible.com/t/nmap-in-ansible/37340/3 "2022-11-15T08:36:53Z")

</div>

Thanks for the reply.  
Yes I am aware but I am used to INI format and the example is in YAML format. Is it possible to convert the same to INI format.  
Below is the example of my inventory which is static  
[centos]

[ubuntu]

& so on…

If I have to execute in ansible, the command I use is — \> **ansible centos -m ping** ---- & so on  
Can you guide me how to do it for nmap ? Please advise!

Manish

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [November 15, 2022, 2:25pm UTC](https://forum.ansible.com/t/nmap-in-ansible/37340/4 "2022-11-15T14:25:36Z")

</div>

no, it uses a yaml configuration file to generate a dynamic inventory,  
which is not the same as an ini inventory file (static)

---

<div class="post-metadata">

**Author:** ![Manish\_Chawda](https://avatars.discourse-cdn.com/v4/letter/m/46a35a/32.png) [@Manish\_Chawda](https://forum.ansible.com/u/Manish_Chawda)\
**Post date:** [November 16, 2022, 1:19pm UTC](https://forum.ansible.com/t/nmap-in-ansible/37340/5 "2022-11-16T13:19:54Z")

</div>

So can you guide me as to how use those nmap configuration in .YAML file and then how to execute ansible i.e. which command to use ansible or ansible-playbook… Please help!

Manish
