DEV Community

Nitin Namdev
Nitin Namdev

Posted on

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 - | 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. is your custom module and the file wll be in the following location

vi ansible/roles/newrole/library/
Enter fullscreen mode Exit fullscreen mode

Top comments (0)