Extending Ansible the write way! How to write an Ansible Module.

By John McDonough

Elevator Pitch

Ansbile is extendable! Write your own modules, for your specific needs. I can show you how to write Ansible modules that support the Ansible recommended module structure. The module will show the right way to utilize argument specs, implement idempotence, check-mode, and how to test.

Description

Ansbile is extendable! You can write your own modules, for your specific needs. I can show you how to write Ansible modules that support the Ansible recommended module structure. The module will show the right way to utilize argument specs, implement idempotence, and check-mode. As well as how to test.

Ansible modules have a basic contract, JSON in and JSON out. What happens in between can be done however you want, so why not do it the ~~write~~ right way. Ansible documentation provides a template for a module, but what goes in each section and what are the best practices for those sections?

This session will show attendees a module at each phase of development and how to test the module locally and against the resource the module will ultimately manage, how to utilize document fragments and how to implement common code across modules with module utils. The sample code used for the session is available on Github and can be used as a jumpstart for attendees’ own module development.