Skip to content

Commit d693f43

Browse files
add example of extending ansible_facts (#2040)
* add example of extending ansible_facts * Apply suggestions from code review Co-authored-by: Felix Fontein <[email protected]> --------- Co-authored-by: Felix Fontein <[email protected]>
1 parent efb2c67 commit d693f43

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/docsite/rst/dev_guide/developing_modules_general.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ Info and facts modules, are just like any other Ansible Module, with a few minor
6464
5. They MUST NOT make any changes to the system.
6565
6. They MUST document the :ref:`return fields<return_block>` and :ref:`examples<examples_block>`.
6666

67+
You can add your facts into ``ansible_facts`` field of the result as follows:
68+
69+
.. code-block:: python
70+
71+
module.exit_json(changed=False, ansible_facts=dict(my_new_fact=value_of_fact))
72+
73+
6774
The rest is just like creating a normal module.
6875

6976
Verifying your module code

0 commit comments

Comments
 (0)