Skip to content

Commit

Permalink
Update playbooks_vars_facts.rst (ansible#72150)
Browse files Browse the repository at this point in the history
Remove misleading typo, add a note on the mode of local facts

Co-authored-by: JensHeinrich <github.com/JensHeinrich>
  • Loading branch information
JensHeinrich authored Oct 9, 2020
1 parent af7fd0f commit 835752c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/docsite/rst/user_guide/playbooks_vars_facts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -541,12 +541,14 @@ You can add static custom facts by adding static files to facts.d, or add dynami

To use facts.d, create an ``/etc/ansible/facts.d`` directory on the remote host or hosts. If you prefer a different directory, create it and specify it using the ``fact_path`` play keyword. Add files to the directory to supply your custom facts. All file names must end with ``.fact``. The files can be JSON, INI, or executable files returning JSON.

To add static facts, simply add a file with the ``.facts`` extension. For example, create ``/etc/ansible/facts.d/preferences.fact`` with this content::
To add static facts, simply add a file with the ``.fact`` extension. For example, create ``/etc/ansible/facts.d/preferences.fact`` with this content::

[general]
asdf=1
bar=2

.. note:: Make sure the file is not executable as this will break the ``ansible.builtin.setup`` module.

The next time fact gathering runs, your facts will include a hash variable fact named ``general`` with ``asdf`` and ``bar`` as members. To validate this, run the following::

ansible <hostname> -m ansible.builtin.setup -a "filter=ansible_local"
Expand Down

0 comments on commit 835752c

Please sign in to comment.