Journey of the development of Ansible Collection? ( Part 1 )

Davinder Pal
2 min readMay 1, 2021

This is a story of building 190+ Ansible Modules which are being later combined into one package called community.missing_collection.

source: minutes.co

Aug 2018

I was working on a Big Data Platform called “MapR” inspired by Apache Hadoop, It had a hell of a lot of components and those were earlier managed by MapR Cli Tool and It was hard to support it and do things with it. I was tasked to upgrade the platform and create/update Automation to do all this stuff because we had 10–15 clusters and I didn’t like to do it manually on all environments. I did manage to create it to upgrade on all clusters but I realized that an upgrade to MapR 6.x was exposing a Rest API to manage all these services.

I was already doing all things with Ansible so thought that It was a good chance to explore Ansible Custom Modules which will make these Rest API calls for me during upgrade and maintenance purpose.

I started reading ansible documentation about creating a module and use it. After reading for a couple of weeks, I was able to make a draft version of it and published it to GitHub @116davinder/ansible.missing_collection and using a custom module in Ansible is quite easy.

Create a python module named “mapr_service.py” and export an Ansible Variable called

ANSIBLE_LIBRARY=<path to mapr_service module directory>

and sample ansible task for it.

- name: 'restart nfs service'
mapr_service:
username: mapr
password: mapr
service_name: nfs
mcs_url: demo.mapr.com
mcs_port: 8443
state: restart
validate_certs: false

I started using the above library in my automation and it worked pretty well. If you haven’t realized that I haven’t shared any useful information so far then you are correct.

I will suggest you read the below-mentioned page as a starting point https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_general.html

Rest, I will share in the next part of this series so have fun!

Here is some good information, which can make your life a bit easier.

Ansible Module: is a piece of code that actually do some real-world work. Example: mapr_service
It provides service management for MapR Ecosystem.

Ansible Collection: is just a collection of several similar modules, which is being developed & published as a package for Ansible.
Example: community.missing_collection by Myself.
It provides 190+ modules for AWS for fact gathering and several modules for AWS, MapR, and NewRelic Management.

--

--