# Cannot get a dictionary in custom facts

**URL:** <https://forum.ansible.com/t/cannot-get-a-dictionary-in-custom-facts/13246>\
**Category:** Ansible Project\
**Created:** [August 2, 2013, 12:51pm UTC](https://forum.ansible.com/t/cannot-get-a-dictionary-in-custom-facts/13246 "2013-08-02T12:51:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grzegorz\_Nosek](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@Grzegorz\_Nosek](https://forum.ansible.com/u/Grzegorz_Nosek)\
**Post date:** [August 2, 2013, 12:51pm UTC](https://forum.ansible.com/t/cannot-get-a-dictionary-in-custom-facts/13246/1 "2013-08-02T12:51:59Z")

</div>

Hi,

As requested in [https://github.com/ansible/ansible/issues/3737](https://github.com/ansible/ansible/issues/3737) I’m bringing this topic to the mailing list.

A simple custom facts module and an associated playbook [https://gist.github.com/gnosek/6139435](https://gist.github.com/gnosek/6139435) end up with an empty dictionary, as seen in the debug output. If I run ansible-playbook with -v (or just call ansible host -m environment), I can see the nested dictionary returned correctly, just like with the default facts module (-m setup).

Any help appreciated.

Best regards,  
Grzegorz Nosek

---

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [August 2, 2013, 1:21pm UTC](https://forum.ansible.com/t/cannot-get-a-dictionary-in-custom-facts/13246/2 "2013-08-02T13:21:10Z")

</div>

‘environment’ is a reserved key word in ansible  
rename the name of that key in your hash to eg. ‘environment\_’ and it will work.

Serge

---

<div class="post-metadata">

**Author:** ![Grzegorz\_Nosek](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@Grzegorz\_Nosek](https://forum.ansible.com/u/Grzegorz_Nosek)\
**Post date:** [August 2, 2013, 1:31pm UTC](https://forum.ansible.com/t/cannot-get-a-dictionary-in-custom-facts/13246/3 "2013-08-02T13:31:04Z")

</div>

W dniu 02.08.2013 15:21, Serge van Ginderachter pisze:

> 'environment' is a reserved key word in ansible  
> rename the name of that key in your hash to eg. 'environment\_' and it  
> will work.

Yup, that did it. Thanks a lot!

Best regards,  
&nbsp;&nbsp;Grzegorz Nosek

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [August 2, 2013, 2:14pm UTC](https://forum.ansible.com/t/cannot-get-a-dictionary-in-custom-facts/13246/4 "2013-08-02T14:14:07Z")

</div>

Good catch Serge! why did I not remember that before! 🙂
