• Home
  • About
  • Blog
  • Products
  • Forum
  • Support
  • Contact
Sun icon

Sunbelt Computer Software

PL/B Language Development and Support

  • Home
  • About
  • Blog
  • Products
  • Forum
  • Support
  • Contact
Developer Guide — Ansible Community Documentation
  • Blog
  • Ansible community forum
  • Documentation
Ansible Logo
Ansible Community Documentation
Ansible

Ansible getting started

  • Getting started with Ansible
  • Getting started with Execution Environments

Installation, Upgrade & Configuration

  • Installation Guide
  • Ansible Porting Guides

Using Ansible

  • Building Ansible inventories
  • Using Ansible command line tools
  • Using Ansible playbooks
  • Protecting sensitive data with Ansible vault
  • Using Ansible modules and plugins
  • Using Ansible collections
  • Using Ansible on Windows, BSD, and z/OS UNIX
  • Ansible tips and tricks

Contributing to Ansible

  • Ansible Community Guide
  • Ansible Collections Contributor Guide
  • ansible-core Contributors Guide
  • Advanced Contributor Guide
  • Ansible documentation style guide

Extending Ansible

  • Developer Guide
    • Adding modules and plugins locally
    • Should you develop a module?
    • Developing modules
    • Contributing your module to an existing Ansible collection
    • Conventions, tips, and pitfalls
    • Ansible and Python 3
    • Debugging modules
    • Module format and documentation
    • Ansible markup
    • Adjacent YAML documentation files
    • Windows module development walkthrough
    • Creating a new collection
    • Testing Ansible
    • The lifecycle of an Ansible module or plugin
    • Developing plugins
    • Developing dynamic inventory
    • Developing ansible-core
    • Ansible module architecture
    • Python API
    • Rebasing a pull request
    • Using and developing module utilities
    • Ansible collection creator path
    • Developing collections
    • Migrating Roles to Roles in Collections on Galaxy
    • Collection Galaxy metadata structure
    • Ansible architecture

Common Ansible Scenarios

  • Legacy Public Cloud Guides

Network Automation

  • Network Getting Started
  • Network Advanced Topics
  • Network Developer Guide

Ansible Galaxy

  • Galaxy User Guide
  • Galaxy Developer Guide

Reference & Appendices

  • Collection Index
  • Indexes of all modules and plugins
  • Playbook Keywords
  • Return Values
  • Ansible Configuration Settings
  • Controlling how Ansible behaves: precedence rules
  • YAML Syntax
  • Python 3 Support
  • Interpreter Discovery
  • Releases and maintenance
  • Testing Strategies
  • Sanity Tests
  • Frequently Asked Questions
  • Glossary
  • Ansible Reference: Module Utilities
  • Special Variables
  • Red Hat Ansible Automation Platform
  • Ansible Automation Hub
  • Logging Ansible output

Roadmaps

  • Ansible Roadmap
  • ansible-core Roadmaps
Ansible
  • Developer Guide
  • Edit on GitHub

'; // Create a banner if we're not on the official docs site if (location.host == "docs.testing.ansible.com") { document.write('
' + '

This is the testing site for Ansible Documentation. Unless you are reviewing pre-production changes, please visit the official documentation website.

' + '
'); } // Create a banner current_url_path = window.location.pathname; var important = false; var msg = '

'; if (startsWith(current_url_path, "/projects/ansible-core/")) { msg += 'You are reading documentation for Ansible Core, which contains no plugins except for those in ansible.builtin. For documentation of the Ansible package, go to the latest documentation.'; /* temp - add extra warning about core-2.19. Included in core 2.19 and later releases */ msg += '

Important: The ansible-core 2.19 release has made significant templating changes that might require you to update playbooks and roles. The templating changes enable reporting of numerous problematic behaviors that went undetected in previous releases, with wide-ranging positive effects on security, performance, and user experience. You should validate your content to ensure compatibility with these templating changes before upgrading to ansible-core 2.19. See the porting guide to understand where you may need to update your playbooks and roles.'; } else if (startsWithOneOf(current_url_path, ["/projects/ansible/latest/", "/projects/ansible/13/"])) { /* temp extra banner to advertise something */ banner += extra_banner; msg += 'This is the latest (stable) Ansible community documentation. For Red Hat Ansible Automation Platform subscriptions, see Life Cycle for version details.'; /* temp - add extra warning about core-2.19. Included in latest package release docs */ msg += '

Important: The ansible-core 2.19/Ansible 12 release has made significant templating changes that might require you to update playbooks and roles. The templating changes enable reporting of numerous problematic behaviors that went undetected in previous releases, with wide-ranging positive effects on security, performance, and user experience. You should validate your content to ensure compatibility with these templating changes before upgrading to ansible-core 2.19 or Ansible 12. See the porting guide to understand where you may need to update your playbooks and roles.'; } else if (startsWith(current_url_path, "/projects/ansible/2.9/")) { msg += 'You are reading the latest Red Hat released version of the Ansible documentation. Community users can use this version, or select latest from the version selector to the left for the most recent community version.'; } else if (startsWith(current_url_path, "/projects/ansible/devel/")) { /* temp extra banner to advertise something */ banner += extra_banner; msg += 'You are reading the devel version of the Ansible documentation - this version is not guaranteed stable. Use the version selection to the left if you want the latest (stable) released version.'; /* temp - add extra warning about core-2.19.Added to latest and devel docs */ msg += '

Important: The ansible-core 2.19/Ansible 12 release has made significant templating changes that might require you to update playbooks and roles. The templating changes enable reporting of numerous problematic behaviors that went undetected in previous releases, with wide-ranging positive effects on security, performance, and user experience. You should validate your content to ensure compatibility with these templating changes before upgrading to ansible-core 2.19 or Ansible 12. See the porting guide to understand where you may need to update your playbooks and roles.'; } else { msg += 'You are reading an older version of the Ansible documentation. Use the version selection to the left if you want the latest (stable) released version.'; /* temp extra banner to advertise something - this is for testing*/ banner += extra_banner; } msg += '

'; banner += '
'; banner += important ? '
' : ''; banner += msg; banner += important ? '
' : ''; banner += '
'; document.write(banner);

Developer Guide

Note

Making Open Source More Inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. We are beginning with these four terms: master, slave, blacklist, and whitelist. We ask that you open an issue or pull request if you come upon a term that we have missed. For more details, see our CTO Chris Wright’s message.

Welcome to the Ansible Developer Guide!

Who should use this guide?

If you want to extend Ansible by using a custom module or plugin locally, creating a module or plugin, adding functionality to an existing module, or expanding test coverage, this guide is for you. We’ve included detailed information for developers on how to test and document modules, as well as the prerequisites for getting your module or plugin accepted into the main Ansible repository.

Find the task that best describes what you want to do:

  • I’m looking for a way to address a use case:

    • I want to add a custom plugin or module locally.

    • I want to figure out if developing a module is the right approach for my use case.

    • I want to understand what a successful collection creator path looks like.

    • I want to develop a collection.

    • I want to contribute to an Ansible-maintained collection.

    • I want to contribute to a community-maintained collection.

    • I want to migrate a role to a collection.

  • I’ve read the info above, and I’m sure I want to develop a module:

    • What do I need to know before I start coding?

    • I want to set up my Python development environment.

    • I want to get started writing a module.

    • I want to write a specific kind of module:
      • a network module

      • a Windows module.

      • an Amazon module.

      • an oVirt/RHV module.

      • a VMware module.

    • I want to write a series of related modules that integrate Ansible with a new product (for example, a database, cloud provider, network platform, and so on).

  • I want to refine my code:

    • I want to debug my module code.

    • I want to add tests.

    • I want to document my module.

    • I want to improve documentation by using Ansible markup.

    • I want to document my set of modules for a network platform.

    • I want to follow conventions and tips for clean, usable module code.

    • I want to make sure my code runs on Python 2 and Python 3.

  • I want to work on other development projects:

    • I want to write a plugin.

    • I want to connect Ansible to a new source of inventory.

    • I want to deprecate an outdated module.

  • I want to contribute back to the Ansible project:

    • I want to understand how to contribute to Ansible.

    • I want to contribute my module or plugin.

    • I want to understand the DCO agreement for contributions to the Ansible Core and Ansible Documentation repositories.

If you prefer to read the entire guide, here’s a list of the pages in order.

  • Adding modules and plugins locally
    • Modules and plugins: what is the difference?
    • Adding modules and plugins in collections
    • Adding a module or plugin outside of a collection
    • Adding a non-module plugin locally outside of a collection
    • Using ansible.legacy to access custom versions of an ansible.builtin module
  • Should you develop a module?
  • Developing modules
    • Preparing an environment for developing Ansible modules
    • Creating a standalone module
    • Creating a module in a collection
    • Creating an info or a facts module
    • Verifying your module code
    • Testing your newly-created module
    • Contributing back to Ansible
    • Communication and development support
    • Credit
  • Contributing your module to an existing Ansible collection
    • Contributing modules: objective requirements
    • Contributing to Ansible: subjective requirements
    • Other checklists
  • Conventions, tips, and pitfalls
    • Scoping your module(s)
    • Designing module interfaces
    • General guidelines & tips
    • Functions and Methods
    • Python tips
    • Importing and using shared code
    • Handling module failures
    • Handling exceptions (bugs) gracefully
    • Creating correct and informative module output
    • Following Ansible conventions
    • Module Security
  • Ansible and Python 3
    • Minimum version of Python 3.x and Python 2.x
    • Developing Ansible code that supports Python 2 and Python 3
  • Debugging modules
    • Detailed debugging steps
    • Simple debugging
  • Module format and documentation
    • Non-Python modules documentation
    • Python shebang & UTF-8 coding
    • Copyright and license
    • DOCUMENTATION block
    • EXAMPLES block
    • RETURN block
    • Python imports
    • Testing module documentation
  • Ansible markup
    • Semantic markup within module documentation
    • Linking within module documentation
    • Format macros within module documentation
  • Adjacent YAML documentation files
    • YAML documentation for plugins
    • YAML format
    • Supported plugin types
  • Windows module development walkthrough
    • Windows environment setup
    • Create a Windows server in a VM
    • Create an Ansible inventory
    • Provisioning the environment
    • Windows new module development
    • Windows module utilities
    • Windows playbook module testing
    • Windows debugging
    • Windows unit testing
    • Windows integration testing
    • Windows communication and development support
  • Creating a new collection
    • Before you start coding
    • Naming conventions
    • Speak to us
    • Where to get support
    • Required files
    • New to Git or GitHub
  • Testing Ansible
    • Why test your Ansible contributions?
    • Types of tests
    • Testing within GitHub & Azure Pipelines
    • How to test a PR
    • Want to know more about testing?
  • The lifecycle of an Ansible module or plugin
    • Deprecating modules and plugins in the Ansible main repository
    • Deprecating modules and plugins in a collection
    • Changing a module or plugin name in the Ansible main repository
    • Renaming a module or plugin in a collection, or redirecting a module or plugin to another collection
    • Tombstoning a module or plugin in a collection
  • Developing plugins
    • Writing plugins in Python
    • Raising errors
    • String encoding
    • Plugin configuration & documentation standards
    • Developing particular plugin types
  • Developing dynamic inventory
    • Inventory sources
    • Inventory plugins
    • Inventory scripts
  • Developing ansible-core
    • ansible-core project branches and tags
    • Ansible module architecture
  • Ansible module architecture
    • Types of modules
    • How modules are executed
  • Python API
  • Rebasing a pull request
    • Configuring your remotes
    • Rebasing your branch
    • Updating your pull request
    • Getting help rebasing
  • Using and developing module utilities
    • Naming and finding module utilities
    • Standard module utilities
  • Ansible collection creator path
    • Examine currently available solutions
    • Create your content
    • Put your content in a collection
    • Write good user collection documentation
    • Publish your collection source code
    • Follow a versioning convention
    • Understand and implement testing and CI
    • Provide good contributor & maintainer documentation
    • Publish your collection on distribution servers
    • Make your collection a part of Ansible community package
    • Maintain
    • Communicate
  • Developing collections
    • Creating collections
    • Using shared resources in collections
    • Testing collections
    • Distributing collections
    • Documenting collections
    • Migrating Ansible content to a different collection
    • Contributing to collections
    • Generating changelogs and porting guide entries in a collection
    • Collection structure
    • Collection Galaxy metadata structure
  • Migrating Roles to Roles in Collections on Galaxy
    • Comparing standalone roles to collection roles
    • Migrating a role to a collection
    • Migrating a role that contains plugins to a collection
    • Using ansible.legacy to access local custom modules from collections-based roles
  • Collection Galaxy metadata structure
    • Structure
    • Examples
  • Ansible architecture
    • Modules
    • Module utilities
    • Plugins
    • Inventory
    • Playbooks
    • The Ansible search path
Previous Next

© Copyright Ansible project contributors. Last updated on Apr 21, 2026.

© 2026 Sunbelt Computer Software