I suppose to expand on that, once you have the name, you can then use

hostvars[item] to effectively get the data associated with the host.

Not an actual Host object, but it should have what you need

On Thu, Jun 1, 2017 at 1:10 PM Matt Martz <m...@sivel.net> wrote:

> There is a lookup that already does this called "inventory_hostnames"
>
>
> https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/lookup/inventory_hostnames.py
>
>
> http://docs.ansible.com/ansible/playbooks_loops.html#looping-over-the-inventory
>
>
> On Thu, Jun 1, 2017 at 1:07 PM Randy Syring <randy.syr...@level12.io>
> wrote:
>
>>  I want to develop a lookup plugin that would take a string like
>> "mygroup:!badhost" and return the list of host objects that match that
>> pattern.
>>
>> Based on my inspection of the Ansible source code, it seems like I could
>> probably do that if I can get reference to an instance of the
>> InventoryManager object.  Can i get access to the inventory object from
>> within a lookup plugin?
>>
>> --
>> 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 ansible-project+unsubscr...@googlegroups.com.
>> To post to this group, send email to ansible-project@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/21974bf8-3f68-47cb-9c13-0328c72e7b5c%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/21974bf8-3f68-47cb-9c13-0328c72e7b5c%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> Matt Martz
> @sivel
> sivel.net
>
-- 
Matt Martz
@sivel
sivel.net

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v_K0O0J9rb3JwaE_hKkgoVDe22rT%2BXR%2B9BaFi0tU%3DjPxg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to