add example of extending ansible_facts (#2040)

* add example of extending ansible_facts

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Sandra McCann
2024-10-24 14:38:45 -04:00
committed by GitHub
parent efb2c671ff
commit d693f43ba7

View File

@@ -64,6 +64,13 @@ Info and facts modules, are just like any other Ansible Module, with a few minor
5. They MUST NOT make any changes to the system.
6. They MUST document the :ref:`return fields<return_block>` and :ref:`examples<examples_block>`.
You can add your facts into ``ansible_facts`` field of the result as follows:
.. code-block:: python
module.exit_json(changed=False, ansible_facts=dict(my_new_fact=value_of_fact))
The rest is just like creating a normal module.
Verifying your module code