# Ansible Create Custom Module

**URL:** <https://forum.ansible.com/t/ansible-create-custom-module/27710>\
**Category:** Ansible Project\
**Created:** [June 5, 2018, 10:19am UTC](https://forum.ansible.com/t/ansible-create-custom-module/27710 "2018-06-05T10:19:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Madushan\_Chathuranga](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@Madushan\_Chathuranga](https://forum.ansible.com/u/Madushan_Chathuranga)\
**Post date:** [June 5, 2018, 10:19am UTC](https://forum.ansible.com/t/ansible-create-custom-module/27710/1 "2018-06-05T10:19:33Z")

</div>

Hi All,

I’m trying to create an custom module to execute some REST calls (I’m aware about uri module which already exists). I have created the module now I’m trying to execute the playbook with my custom module. I placed it under the modules folder.  
my folder structure is like  
ansible

> - playbook.yaml
> 
> \_\_modules
> 
> - custon\_module.py
> 
> \_\_module\_utils

- decoder.py

but when i execute the playbook I get an error for the task which i have used the custom\_module. then i changed the structure and added a new directory named **library** to the **ansible** folder and moved the custon\_module.py file in to library folder. there after the playbook.yaml seems to be working fine. Anyone know the reason for this behavior ? Is there any thing else I need to do in order to place the custom\_module.py in the **modules** folder.

Thanks you.

---

<div class="post-metadata">

**Author:** ![mhalano](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mhalano/32/1815_2.png) [@mhalano](https://forum.ansible.com/u/mhalano)\
**Post date:** [June 5, 2018, 2:11pm UTC](https://forum.ansible.com/t/ansible-create-custom-module/27710/2 "2018-06-05T14:11:59Z")

</div>

The reason is because “library” is the place for all custom modules, not “modules”.
