You can also create the mentioned script an invoke it as local_action:
before your remote nmap task.
On Apr 6, 2014 4:06 PM, "James Cammarata" <[email protected]> wrote:

> There are a couple of options you could use here. First, you could deploy
> a custom fact that would give you the CIDR value. Second, you could write a
> custom jinja2 filter that would accept a netmask (for example,
> ansible_eth0.ipv4.netmask) and convert that to a CIDR value.
>
>
> On Fri, Apr 4, 2014 at 12:28 PM, txemi Martínez <[email protected]>wrote:
>
>> I am starting with ansible and sometimes I find things that I would be
>> able to program in python, bash or java but I do not know hot to handle in
>> ansible playbooks.
>>
>> I want some remote machine to make an nmap on all local networks. This is
>> the command I want:
>>
>> nmap -T4 -A -F -oX /tmp/${filename} 192.168.20.0/24  192.168.21.0/24
>>
>> Being  192.168.20.0/24 and 192.168.21.0/24 two networks for eth0 and
>> eth1 interfaces, when I do not know how many interfaces are there at
>> playbook execution time.
>>
>> This is what I am actually using:
>>
>>   - command:  nmap -T4 -A -F -oX /tmp/${filename}
>> ${ansible_eth0.ipv4.network}/24
>>
>> but this is not what I want because 24 is hardcoded (no obtained from
>> ansible_eth0.ipv4.mask fact) and eth1 is missing.
>> This information is already available in facts but I need some processing
>> for building nmap command line and I do not know how to scape to some
>> programming language to do this.
>>
>> Things I think about:
>> - Can I pass the facts to an external or inline script that do this for
>> me and then I get de command line?
>> - Should I make an ansible module for nmap? But can I access facts from
>> within the module?
>> - I could also use the script module and upload a bash script to do it
>> but I would like to use facts and other configuration and logic available
>> locally as well as having granular local control of each operation, cooking
>> de command first and executing it then via command module for instance. If
>> I finally have to upload  a complex script for each operation I do not see
>> the point in using ansible architecture instead of using bare paramiko or
>> ssh.
>>
>> Thanks,
>> txemi.
>>
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/127d5d4e-70d8-4ae2-81c3-db53021fc5cd%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/127d5d4e-70d8-4ae2-81c3-db53021fc5cd%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAFg%2Bn8S-4C5nDWgChxUyafaTMMXFQWWXy-rOVHEyDW2vfw2qzw%40mail.gmail.com<https://groups.google.com/d/msgid/ansible-project/CAFg%2Bn8S-4C5nDWgChxUyafaTMMXFQWWXy-rOVHEyDW2vfw2qzw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAM44GReR1%3DQFH4fPqN2tex1Puy%2B_ap6K76NP4nUQ07UnfJuO3w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to