Contributing your module to Ansible¶
If you want to contribute a module to Ansible, you must meet our objective and subjective requirements. Please read the details below, and also review our tips for module development.
Modules accepted into the main project repo ship with every Ansible installation. However, contributing to the main project isn’t the only way to distribute a module - you can embed modules in roles on Galaxy or simply share copies of your module code for local use.
Contributing to Ansible: objective requirements¶
To contribute a module to Ansible, you must:
write your module in either Python or Powershell for Windows
use the
AnsibleModule
common codesupport Python 2.7 and Python 3.5 - if your module cannot support Python 2.7, explain the required minimum Python version and rationale in the requirements section in
DOCUMENTATION
use proper Python 3 syntax
follow PEP 8 Python style conventions - see PEP 8 for more information
license your module under the GPL license (GPLv3 or later)
understand the license agreement, which applies to all contributions
conform to Ansible’s formatting and documentation standards
include comprehensive tests for your module
minimize module dependencies
support check_mode if possible
ensure your code is readable
if a module is named
<something>_facts
, it should be because its main purpose is returningansible_facts
. Do not name modules that do not do this with_facts
. Only useansible_facts
for information that is specific to the host machine, for example network interfaces and their configuration, which operating system and which programs are installed.Modules that query/return general information (and not
ansible_facts
) should be named_info
. General information is non-host specific information, for example information on online/cloud services (you can access different accounts for the same online service from the same host), or information on VMs and containers accessible from the machine.
Please make sure your module meets these requirements before you submit your PR/proposal. If you have questions, reach out via Ansible’s #ansible-devel IRC chat channel or the Ansible development mailing list.
Contributing to Ansible: subjective requirements¶
If your module meets our objective requirements, we’ll review your code to see if we think it’s clear, concise, secure, and maintainable. We’ll consider whether your module provides a good user experience, helpful error messages, reasonable defaults, and more. This process is subjective, and we can’t list exact standards for acceptance. For the best chance of getting your module accepted into the Ansible repo, follow our tips for module development.