ansible fact list

18 views
Skip to first unread message

Orkhan Mammadov

unread,
May 2, 2020, 9:02:48 PM5/2/20
to Ansible Project
Hi guys,

I would like to check the facts list in ansible, it should be located in /etc/ansible/facts.d directory. But ansible directory under /etc is not exist. Is there different location that facts are located?

Thanks.

Neha Pithadiya

unread,
May 3, 2020, 12:48:54 AM5/3/20
to Ansible Project

Have you created this custom facts file ?
By default custom facts can be created and stored locally on each managed host. The /etc/ansible/facts.d directory does not exists by default. You will need to create this directory on each managed host , can use "file" module to do so. You can then copy the facts file into this directory for use by the playbook .


Thanks
Neha Pithadiya.

Brian Coca

unread,
May 4, 2020, 9:49:10 AM5/4/20
to Ansible Project
As @Neha points out /etc/ansible/facts.d is a way to generate facts,
does not list them.

Here is a way to generate a copy of the facts for a server (on the
machine that executes Ansible) :

`ansible -m gather_facts <hostname> --tree /var/tmp/ `

it will create a json file per host in '/var/tmp' with the output of
the module executed, in this case 'fact gathering'.

----------
Brian Coca

Reply all
Reply to author
Forward
0 new messages