# Facts no longer available in lookup plugin

**URL:** <https://forum.ansible.com/t/facts-no-longer-available-in-lookup-plugin/19050>\
**Category:** Ansible Project\
**Created:** [August 19, 2015, 8:42am UTC](https://forum.ansible.com/t/facts-no-longer-available-in-lookup-plugin/19050 "2015-08-19T08:42:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christian\_Hammerl](https://avatars.discourse-cdn.com/v4/letter/c/67e7ee/32.png) [@Christian\_Hammerl](https://forum.ansible.com/u/Christian_Hammerl)\
**Post date:** [August 19, 2015, 8:42am UTC](https://forum.ansible.com/t/facts-no-longer-available-in-lookup-plugin/19050/1 "2015-08-19T08:42:46Z")

</div>

Some time ago, I wrote a small lookup plugin [https://github.com/mantiz/ansible-lookup-plugin-os-specific](https://github.com/mantiz/ansible-lookup-plugin-os-specific)

This plugin allows/allowed to define a list of items where each item could be specialized for a specific os or distribution.  
For this to work, I need the facts to access ansible\_distribution and so on.

Yesterday, I updated to the latest git version of ansible and the facts seem no longer be passed to the module.

Is there another way to access the facts from inside the module?

The only workaround I found was to pass the facts manually, like:

`

- some\_task: …  
with\_os\_specific:  
facts: “{{ vars }}”  
items:
- …

`

But this is annoying and easy to forget.

If there is no way to access the facts, is there any other way to solve the issue, the plugin solves?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [August 20, 2015, 3:05am UTC](https://forum.ansible.com/t/facts-no-longer-available-in-lookup-plugin/19050/2 "2015-08-20T03:05:54Z")

</div>

the 3rd var passed into the run method are the host variables, which  
should include facts.

---

<div class="post-metadata">

**Author:** ![Christian\_Hammerl](https://avatars.discourse-cdn.com/v4/letter/c/67e7ee/32.png) [@Christian\_Hammerl](https://forum.ansible.com/u/Christian_Hammerl)\
**Post date:** [August 20, 2015, 3:43pm UTC](https://forum.ansible.com/t/facts-no-longer-available-in-lookup-plugin/19050/3 "2015-08-20T15:43:22Z")

</div>

Oh dear, thank you very much.  
It was previously the 2nd variable which contained the facts and I didn’t even think about inspecting the third one. 😉

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [August 20, 2015, 3:45pm UTC](https://forum.ansible.com/t/facts-no-longer-available-in-lookup-plugin/19050/4 "2015-08-20T15:45:24Z")

</div>

I see it as the third (counting self) in both versions.

---

<div class="post-metadata">

**Author:** ![Christian\_Hammerl](https://avatars.discourse-cdn.com/v4/letter/c/67e7ee/32.png) [@Christian\_Hammerl](https://forum.ansible.com/u/Christian_Hammerl)\
**Post date:** [August 20, 2015, 10:04pm UTC](https://forum.ansible.com/t/facts-no-longer-available-in-lookup-plugin/19050/5 "2015-08-20T22:04:55Z")

</div>

Hm, that’s strange.

Previously, my method’s signature was:

`def run(self, terms, inject=None, **kwargs):`

I’m no python guy and I really don’t know what this ‘kwargs’ means but I think it may be related to named parameters.  
The above signature worked until I updated ansible yesterday to the current master.

If I change the signature to this:

`def run(self, terms, variables=None, **kwargs):`

the variables parameter is set accordingly but kwargs no longer has a key ‘variables’.

So, I think this parameter was renamed from ‘inject’ to ‘variables’ some time ago, or the method caller changed from positional parameters to named parameters, I don’t know.

However, the facts are now accessible through “variables[‘vars’]” which is fine for me.

Thanks again for your help which pointed me to the right direction.
