1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Update developing_modules.rst (#18646)

I was wondering how to return a new fact from a module I got the answer on IRC thx to "mgedmin".
I read this doc several time but didn't understood that I had to return a "ansible_facts" in the module.exit_json.
This change is about showing a sample code of it to help the next reader ;)
This commit is contained in:
Erwan Velu 2016-12-02 09:34:27 +01:00 committed by John R Barker
parent 8c03fec67a
commit a252d71573

View file

@ -247,6 +247,10 @@ These 'facts' will be available to all statements called after that module (but
A good idea might be to make a module called 'site_facts' and always call it at the top of each playbook, though
we're always open to improving the selection of core facts in Ansible as well.
Returning a new fact from a python module could be done like::
module.exit_json(msg=message, ansible_facts=dict(leptons=5000, colors=my_colors))
.. _common_module_boilerplate:
Common Module Boilerplate