mirror of
https://github.com/ansible/ansible-documentation.git
synced 2026-03-27 13:28:51 +07:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user