DEV Community

Nitin Namdev
Nitin Namdev

Posted on

1

Ansible Sandbox for Developing Custom Module

Hello all,

Today ansible is the most popular tool in the automation part, so for creating playbook, roles and modules you need to do too much manual work, for getting rid from this I have created a script that will create a ansible role structure with tasks, handlers, deafults, template and library

And also I created a hello custom module that is called in the task so you can work without any manual work, you can directly run the command and you will have ready to go ansible environment.

Simply run the following command —

cd /opt/
wget -O - https://raw.githubusercontent.com/vortexdude/src/main/script.sh | bash -s newrole
Enter fullscreen mode Exit fullscreen mode

After running the above command in your linux you need the package of ansible and wget and git.

to run the ansible playbook —

ansible-playbook ansible/main.yml 
Enter fullscreen mode Exit fullscreen mode

also it will create the inventory file where you can define you all of the servers the path of the inventory will be inventory/all.

hello.py is your custom module and the file wll be in the following location

vi ansible/roles/newrole/library/hello.py
Enter fullscreen mode Exit fullscreen mode

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay