# custom facts with non-root account

**URL:** <https://forum.ansible.com/t/custom-facts-with-non-root-account/21193>\
**Category:** Ansible Project\
**Created:** [April 18, 2016, 2:44pm UTC](https://forum.ansible.com/t/custom-facts-with-non-root-account/21193 "2016-04-18T14:44:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Uwe\_Bartels](https://avatars.discourse-cdn.com/v4/letter/u/c57346/32.png) [@Uwe\_Bartels](https://forum.ansible.com/u/Uwe_Bartels)\
**Post date:** [April 18, 2016, 2:44pm UTC](https://forum.ansible.com/t/custom-facts-with-non-root-account/21193/1 "2016-04-18T14:44:24Z")

</div>

Hiho,

I’m currently working with most recent ansible in a very restricted system environment, e.g. I don’t have root access.

now I’m gathering data via shell commands and register.  
E.g.

- name: check for java installation  
shell: ls {{ installdir }}  
register: installdircontent

I’d like to gather information via facts, because the “PLAY RECAP” shows “changed=xx”, but I’m only collecting information and don’t change, when everything is fine.

custom facts can only placed in /etc/ansible/fact.d as described in the docs.  
Is there any possibility to gather facts with non-root permissions?

Best Regards,  
Uwe

---

<div class="post-metadata">

**Author:** ![Matt\_Davis](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@Matt\_Davis](https://forum.ansible.com/u/Matt_Davis)\
**Post date:** [April 21, 2016, 10:46pm UTC](https://forum.ansible.com/t/custom-facts-with-non-root-account/21193/2 "2016-04-21T22:46:43Z")

</div>

Yes, you just need to call the [setup module](http://docs.ansible.com/ansible/setup_module.html) yourself (instead of letting gather\_facts call it for you) and pass fact\_path to a location you have control over. eg:

- hosts: myhosts  
gather\_facts: no  
tasks:

# calling setup manually will still store all the facts normally

- setup:  
fact\_path: /home/me/myfacts
- shell: echo “do stuff”

-Matt

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [May 3, 2016, 6:27am UTC](https://forum.ansible.com/t/custom-facts-with-non-root-account/21193/3 "2016-05-03T06:27:52Z")

</div>

Apart from calling setup, like Matt suggested, one idead is to use  
changed\_when to describe when your task should be reported as changed.

Johannes
