diff --git a/docsite/rst/developing_modules.rst b/docsite/rst/developing_modules.rst index 3b563ee755..44051d3c68 100644 --- a/docsite/rst/developing_modules.rst +++ b/docsite/rst/developing_modules.rst @@ -449,6 +449,44 @@ a github pull request to the `extras use fail_json() from the module object +* Import custom packages in try/except and handled with fail_json() in main() e.g.:: + + try: + import foo + HAS_LIB=True + except: + HAS_LIB=False + +* Are module actions idempotent? If not document in the descriptions or the notes +* Import module snippets `from ansible.module_utils.basic import *` at the bottom, conserves line numbers for debugging. +* Try to normalize parameters with other modules, you can have aliases for when user is more familiar with underlying API name for the option +* Being pep8 compliant is nice, but not a requirement. Specifically, the 80 column limit now hinders readability more that it improves it +* Avoid '`action`/`command`', they are imperative and not declarative, there are other ways to express the same thing +* Sometimes you want to split the module, specially if you are adding a list/info state, you want a _facts version +* If you are asking 'how can i have a module execute other modules' ... you want to write a role + Deprecating and making module aliases ``````````````````````````````````````