# Valid INI format in local facts

**URL:** <https://forum.ansible.com/t/valid-ini-format-in-local-facts/16783>\
**Category:** Ansible Project\
**Created:** [November 14, 2014, 8:14am UTC](https://forum.ansible.com/t/valid-ini-format-in-local-facts/16783 "2014-11-14T08:14:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandra.kosmalla](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@sandra.kosmalla](https://forum.ansible.com/u/sandra.kosmalla)\
**Post date:** [November 14, 2014, 8:14am UTC](https://forum.ansible.com/t/valid-ini-format-in-local-facts/16783/1 "2014-11-14T08:14:21Z")

</div>

Hi,

I’m newbie using Ansible (1.7.2) and try to write my first local fact using INI. According to Wikipedia ([http://en.wikipedia.org/wiki/INI\_file#Format](http://en.wikipedia.org/wiki/INI_file#Format)), a INI file with only key-value pairs is a valid INI format.

Example:

foo=bar

So my local fact /etc/ansible/facts.d/test.fact has only key-value pairs. Calling ansible localhost -m setup -a “filter=ansible\_local” returns following error

localhost | success \>\> {  
“ansible\_facts”: {  
“ansible\_local”: {  
“test”: “error loading fact - please check content”  
}  
},  
“changed”: false  
}

My expectation is the following output

localhost | success \>\> {  
“ansible\_facts”: {  
“ansible\_local”: {  
“test”: {  
“foo”: “bar”  
}  
}  
},  
“changed”: false  
}

When I add in my local fact a section like

[section]  
foo=bar

then no error is thrown.

So my question is, is it a bug or a conscious decision for not supporting only key-value pairs or is the wikipedia article wrong?

Regards,

Sandra

---

<div class="post-metadata">

**Author:** ![Toshio\_Kuratomi](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@Toshio\_Kuratomi](https://forum.ansible.com/u/Toshio_Kuratomi)\
**Post date:** [November 16, 2014, 4:03pm UTC](https://forum.ansible.com/t/valid-ini-format-in-local-facts/16783/2 "2014-11-16T16:03:56Z")

</div>

Ini is not a standardized format so many things about it are defined  
by implementation. In our case, we're using configparser from the  
python stdlib which will be present on all platforms where ansible  
runs. Requiring a top-level section is a feature of configparser:

"The configuration file consists of sections, led by a [section]  
header and followed by name: value entries,"

-[https://docs.python.org/2/library/configparser.html](https://docs.python.org/2/library/configparser.html)

---

<div class="post-metadata">

**Author:** ![sandra.kosmalla](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@sandra.kosmalla](https://forum.ansible.com/u/sandra.kosmalla)\
**Post date:** [November 18, 2014, 12:01pm UTC](https://forum.ansible.com/t/valid-ini-format-in-local-facts/16783/3 "2014-11-18T12:01:04Z")

</div>

Thank you for the explanation.
