NMAP in Ansible

215 views
Skip to first unread message

manish...@gmail.com

unread,
Nov 14, 2022, 3:57:50 AM11/14/22
to Ansible Project
Hi,

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

Manish

Brian Coca

unread,
Nov 14, 2022, 10:42:17 AM11/14/22
to ansible...@googlegroups.com
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


--
----------
Brian Coca

Manish Chawda

unread,
Nov 15, 2022, 3:37:13 AM11/15/22
to ansible...@googlegroups.com
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]
<IP>

[ubuntu]
<IP>

& 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

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/xsRuo7AdEbI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CACVha7fVK0ntDY%2BxfSyt4U5hp%2BVOG8mDx8u4%2BRhpXTJxzC38hQ%40mail.gmail.com.

Brian Coca

unread,
Nov 15, 2022, 9:27:27 AM11/15/22
to ansible...@googlegroups.com
no, it uses a yaml configuration file to generate a dynamic inventory,
which is not the same as an ini inventory file (static)



--
----------
Brian Coca

Manish Chawda

unread,
Nov 16, 2022, 8:20:21 AM11/16/22
to ansible...@googlegroups.com
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

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/xsRuo7AdEbI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages