How to create an Ansible Module/Library - Blog step-by-step

Hello all,

I’ve personally created several Ansible modules, and to share this expertise, I’ve written a helpful blog post that may inspire others. I’ll walk you through the process of creating an Ansible module step by step. Here’s the link to the blog post I wrote.

https://babelvis.nl/2025/10/17/how-to-create-an-ansible-module/

Please note: English isn’t my native language :slight_smile: The blog post is in English, but the rest of the website is in Dutch.

Greetings, Bas.

2 Likes

@Opvolger hello, thanks for the blog post!
I would suggest running ansible-test sanity <you-module-file> --docker against your module: I see a few things to improve.
Thanks

1 Like

I didn’t know that command. remove the 1ste line #!/usr/bin/python and format the code with the autopep8 plugin in vs-code and all the errors are gone.

Thnx learned something today :slight_smile:

2 Likes

@Opvolger sure, you’re welcome!
You can also check this post out for more ideas for your blog, in particular, a next step could be how to cover your module with integration tests to make sure it works as expected and how to run them locally. It’s in p. 3 Creating an Ansible collection with a simple module step-by-step.

all ready did make collections with test for work. Never make one publicly available. (where only intern usable) So i will start at p. 5

1 Like