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

@ -246,6 +246,10 @@ this, just have the module return a `ansible_facts` key, like so, along with oth
These 'facts' will be available to all statements called after that module (but not before) in the playbook.
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: