# AttributeError: 'module' object has no attribute 'ModuleReplacer' when trying to create a custom module

**URL:** <https://forum.ansible.com/t/attributeerror-module-object-has-no-attribute-modulereplacer-when-trying-to-create-a-custom-module/13934>\
**Category:** Ansible Project\
**Created:** [November 19, 2013, 12:42pm UTC](https://forum.ansible.com/t/attributeerror-module-object-has-no-attribute-modulereplacer-when-trying-to-create-a-custom-module/13934 "2013-11-19T12:42:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lars\_Vonk](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@Lars\_Vonk](https://forum.ansible.com/u/Lars_Vonk)\
**Post date:** [November 19, 2013, 12:42pm UTC](https://forum.ansible.com/t/attributeerror-module-object-has-no-attribute-modulereplacer-when-trying-to-create-a-custom-module/13934/1 "2013-11-19T12:42:22Z")

</div>

Hi,

I am trying to create a custom module based on pyrax (rackspace) to create reverse dns entries. I followed the hacking guide but I am stuck testing the new module because of an AttributeError: ‘module’ object has no attribute ‘ModuleReplacer’ error.

My set up is as follows:

Mac OSX, installed python with brew and using pip for the dependencies. Local python is at /usr/local/bin/python. Then I following the hacking guide at [The Manifesto for Agentic Automation](http://www.ansibleworks.com/docs/developing_modules.html) and checked out ansible, ran ./hacking/env-setup and than:

./hacking/test-module -m ../servers/modules/rax\_dns

Output:

Traceback (most recent call last):

File “./hacking/test-module”, line 163, in

main()

File “./hacking/test-module”, line 147, in main

(modfile, module\_style) = boilerplate\_module(options.module\_path, options.module\_args)

File “./hacking/test-module”, line 84, in boilerplate\_module

replacer = module\_common.ModuleReplacer()

The rax\_dns:

#!/usr/bin/python #changing this to /usr/local/bin/python has no effect.

import pyrax

def main():

module = AnsibleModule(

argument\_spec = dict(

credentials = dict(required=True),

hostname = dict(required=True)

)

)

pyrax.set\_setting(“identity\_type”, “rackspace”)

pyrax.set\_credential\_file(credentials)

# include magic from lib/ansible/module\_common.py

#\<\<INCLUDE\_ANSIBLE\_MODULE\_COMMON\>\>

main()

What am I missing? Also can I put my custom modules in my own project? Or do they need to be in the ansible directory?

Lars

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [November 19, 2013, 1:16pm UTC](https://forum.ansible.com/t/attributeerror-module-object-has-no-attribute-modulereplacer-when-trying-to-create-a-custom-module/13934/2 "2013-11-19T13:16:03Z")

</div>

Hi, as this is a question about developing modules, please post this to the [ansible-devel@googlegroups.com](mailto:ansible-devel@googlegroups.com) list and we’ll help out.

Thanks!

---

<div class="post-metadata">

**Author:** ![Lars\_Vonk](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@Lars\_Vonk](https://forum.ansible.com/u/Lars_Vonk)\
**Post date:** [November 19, 2013, 1:40pm UTC](https://forum.ansible.com/t/attributeerror-module-object-has-no-attribute-modulereplacer-when-trying-to-create-a-custom-module/13934/3 "2013-11-19T13:40:13Z")

</div>

Ok will do.

Lars
