# creating collection skeleton using resource module builder

**URL:** <https://forum.ansible.com/t/creating-collection-skeleton-using-resource-module-builder/35683>\
**Category:** Ansible Project\
**Created:** [August 27, 2021, 11:12am UTC](https://forum.ansible.com/t/creating-collection-skeleton-using-resource-module-builder/35683 "2021-08-27T11:12:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nitesh\_shet](https://avatars.discourse-cdn.com/v4/letter/n/7ea924/32.png) [@nitesh\_shet](https://forum.ansible.com/u/nitesh_shet)\
**Post date:** [August 27, 2021, 11:12am UTC](https://forum.ansible.com/t/creating-collection-skeleton-using-resource-module-builder/35683/1 "2021-08-27T11:12:24Z")

</div>

Hi,

For creating custom collection scaffold i have used resource module builder from the below link:  
[ansible-network/resource\_module\_builder: Scaffold and maintain resource modules (github.com)](https://github.com/ansible-network/resource_module_builder)

for, customisation purpose had written a model(thanos\_ntp.yml) for custom module and added the example files as well.

but when i ran the site.yml file for my model by providing all the necessary arguments i am getting below error:  
The full traceback is:  
Traceback (most recent call last):  
File “/home/nshet/rmb/resource\_module\_builder/roles/scaffold\_rm\_facts/filter\_plugins/to\_doc.py”, line 144, in validate\_model  
raise AnsibleError(“Error while parsing module: %s” % err)  
ansible.errors.AnsibleError: Error while parsing module: b"ERROR! Unexpected Exception, this is probably a bug: ‘NoneType’ object has no attribute ‘pop’\n"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):  
File “/home/nshet/.local/lib/python3.6/site-packages/ansible/plugins/action/template.py”, line 146, in run  
resultant = templar.do\_template(template\_data, preserve\_trailing\_newlines=True, escape\_backslashes=False)  
File “/home/nshet/.local/lib/python3.6/site-packages/ansible/template/ **init**.py”, line 1094, in do\_template  
res = j2\_concat(rf)  
File “”, line 35, in root  
File “/home/nshet/.local/lib/python3.6/site-packages/ansible/template/ **init**.py”, line 265, in wrapper  
ret = func(\*args, \*\*kwargs)  
File “/home/nshet/rmb/resource\_module\_builder/roles/scaffold\_rm\_facts/filter\_plugins/to\_doc.py”, line 178, in to\_doc  
validate\_model(model, contents)  
File “/home/nshet/rmb/resource\_module\_builder/roles/scaffold\_rm\_facts/filter\_plugins/to\_doc.py”, line 148, in validate\_model  
% (err, contents))  
ansible.errors.AnsibleError: Failed to validate the model with error: Error while parsing module: b"ERROR! Unexpected Exception, this is probably a bug: ‘NoneType’ object has no attribute ‘pop’\n"

Can you please help me to overcome this problem?

Thanks,  
Nitesh

> **(attachments)**
>
> [model\_file.txt](https://forum.ansible.com/uploads/short-url/oPNBGEIxW2M5gkoqItKJ2USSVJ4.txt) (2.32 KB)

---

<div class="post-metadata">

**Author:** ![Nilashish\_Chakrabort](https://avatars.discourse-cdn.com/v4/letter/n/f475e1/32.png) [@Nilashish\_Chakrabort](https://forum.ansible.com/u/Nilashish_Chakrabort)\
**Post date:** [August 27, 2021, 11:37am UTC](https://forum.ansible.com/t/creating-collection-skeleton-using-resource-module-builder/35683/2 "2021-08-27T11:37:15Z")

</div>

Hi Nitesh,

There seems to be an indentation issue in the model you shared, which is why the model validation is failing. The sub keys under config are not placed properly. Can you try fixing those and re-run the builder?  
Also, if you’re building a CLI based module, I would highly recommend using [https://github.com/ansible-network/cli\_rm\_builder](https://github.com/ansible-network/cli_rm_builder) instead of this.

Thanks.

---

<div class="post-metadata">

**Author:** ![nitesh\_shet](https://avatars.discourse-cdn.com/v4/letter/n/7ea924/32.png) [@nitesh\_shet](https://forum.ansible.com/u/nitesh_shet)\
**Post date:** [August 27, 2021, 12:07pm UTC](https://forum.ansible.com/t/creating-collection-skeleton-using-resource-module-builder/35683/3 "2021-08-27T12:07:57Z")

</div>

Thank you, can you please explain me the benefit of the [https://github.com/ansible-network/cli\_rm\_builder](https://github.com/ansible-network/cli_rm_builder) over normal resource module builder.?

---

<div class="post-metadata">

**Author:** ![KB-perByte](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kb-perbyte/32/541_2.png) [@KB-perByte](https://forum.ansible.com/u/KB-perByte)\
**Post date:** [August 30, 2021, 5:18pm UTC](https://forum.ansible.com/t/creating-collection-skeleton-using-resource-module-builder/35683/4 "2021-08-30T17:18:14Z")

</div>

Hey Nitesh,

For a cli based module, we recommend cli\_rm\_builder, but there are a few more things that make the cli\_rm\_builder different from resource\_module\_builder, like -

- with cli\_rm\_builder the code that is scaffolded with RMEngineBase which is leveraged by Ansible Network Team for cli based resource modules.

- the code that gets scaffolded is more consistent over the platforms available, even makes the whole development faster and better in terms of experience.

- implementation of facts is easier as parsers are defined to generate facts.

- the model is the docstring that becomes the argspec and the Source Of truth (SOT), that can be updated on the go and the tool takes care of all the updates in the model in terms of argspec.

- the state-based implementation of logic is cleaner as the logic is written over a defined structured data aka facts.

these are few points of how the cli\_rm\_builder based resource module development is better in terms of resource\_module\_builder. You can get more details [here](https://github.com/ansible-network/cli_rm_builder/blob/main/docs/rm_dev_guide.md)!  
Thanks

Sagar Paul  
Associate Software Engineer, Ansible

---

<div class="post-metadata">

**Author:** ![nitesh\_shet](https://avatars.discourse-cdn.com/v4/letter/n/7ea924/32.png) [@nitesh\_shet](https://forum.ansible.com/u/nitesh_shet)\
**Post date:** [August 30, 2021, 7:33pm UTC](https://forum.ansible.com/t/creating-collection-skeleton-using-resource-module-builder/35683/5 "2021-08-30T19:33:34Z")

</div>

Thank you for such a beautiful explanation
