# How To Implement Module Defaults Groups For Custom Group Or Collection

**URL:** <https://forum.ansible.com/t/how-to-implement-module-defaults-groups-for-custom-group-or-collection/35598>\
**Category:** Ansible Project\
**Tags:** azure, aws\
**Created:** [August 8, 2021, 1:53am UTC](https://forum.ansible.com/t/how-to-implement-module-defaults-groups-for-custom-group-or-collection/35598 "2021-08-08T01:53:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dhiwakar\_Ravikumar](https://avatars.discourse-cdn.com/v4/letter/d/ecc23a/32.png) [@Dhiwakar\_Ravikumar](https://forum.ansible.com/u/Dhiwakar_Ravikumar)\
**Post date:** [August 8, 2021, 1:53am UTC](https://forum.ansible.com/t/how-to-implement-module-defaults-groups-for-custom-group-or-collection/35598/1 "2021-08-08T01:53:41Z")

</div>

This link  
[https://docs.ansible.com/ansible/latest/user\_guide/playbooks\_module\_defaults.html](https://docs.ansible.com/ansible/latest/user_guide/playbooks_module_defaults.html)

mentions a way to define a default for a group of modules such as aws, azure etc.

I have a namespace.collection of modules that I’ve written, these are custom modules and I’m wondering how to achieve this for my collection of modules.

For example. I’d like to always specify VAR1:SOME\_VALUE to any task in the playbook using a module from my namespace.collection without writing it for every single task separately.

module\_defaults:  
group/MYNAMESPACE.MYCOLLECTION:  
**VAR1: SOME\_VALUE**

or some equivalent but I haven’t been successful so far.

Thanks  
Dhiwakar

---

<div class="post-metadata">

**Author:** ![Erik\_Godding\_Boye](https://avatars.discourse-cdn.com/v4/letter/e/7ab992/32.png) [@Erik\_Godding\_Boye](https://forum.ansible.com/u/Erik_Godding_Boye)\
**Post date:** [August 8, 2021, 5:30am UTC](https://forum.ansible.com/t/how-to-implement-module-defaults-groups-for-custom-group-or-collection/35598/2 "2021-08-08T05:30:46Z")

</div>

[https://gist.github.com/s-hertel/725ecc719b5301e76c571aca58d39bd3](https://gist.github.com/s-hertel/725ecc719b5301e76c571aca58d39bd3)
