Writing ansible modules using Golang

The author has never been a fan of dynamic languages in general and Python in particular. But working a lot with Ansible he feels that sometimes an ansible role doesn’t cut it, and it would be better to write a module. I’ve recently started playing around with Golang, and I feel it could potentially be utilized for such a task. Hence, I’ve made this project to experiment and provide examples of how Ansible modules could be written in Golang.

He is going to utilize ansible’s binary modules, the same principles can be used to write Ansible modules in any other programming language that can build code as native executables.

For example, one could in theory write ansible modules in java, build them as native images with Graal, and use those images as ansible binary modules. In practice, though, it’s probably an overkill to write Ansible modules in java.

It is worth noting that in many cases python is still much more preferable to use when developing ansible modules.

Golang/Ansible Code Structure

This repo consists of the following: