# Error running module out of 'library' with Ansible 2.2.0 from epel

**URL:** <https://forum.ansible.com/t/error-running-module-out-of-library-with-ansible-2-2-0-from-epel/23544>\
**Category:** Ansible Project\
**Created:** [January 24, 2017, 6:45am UTC](https://forum.ansible.com/t/error-running-module-out-of-library-with-ansible-2-2-0-from-epel/23544 "2017-01-24T06:45:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rob\_White](https://avatars.discourse-cdn.com/v4/letter/r/71c47a/32.png) [@Rob\_White](https://forum.ansible.com/u/Rob_White)\
**Post date:** [January 24, 2017, 6:45am UTC](https://forum.ansible.com/t/error-running-module-out-of-library-with-ansible-2-2-0-from-epel/23544/1 "2017-01-24T06:45:47Z")

</div>

I have installed Ansible 2.2.0 from epel on an Amazon Linux image.

I have created a ‘library’ directory in /etc/ansible and added my own custom module. Actually the module is iam\_role.py that has already been merged to Ansible but not yet available until 2.3.

When running my playbook i get the following error when it gets to the iam\_role task:

`

An exception occurred during task execution. The full traceback is:  
Traceback (most recent call last):  
File “/usr/lib/python2.6/site-packages/ansible/executor/task\_executor.py”, line 119, in run  
res = self.\_execute()  
File “/usr/lib/python2.6/site-packages/ansible/executor/task\_executor.py”, line 490, in \_execute  
result = self.\_handler.run(task\_vars=variables)  
File “/usr/lib/python2.6/site-packages/ansible/plugins/action/normal.py”, line 33, in run  
results = merge\_hash(results, self.\_execute\_module(tmp=tmp, task\_vars=task\_vars))  
File “/usr/lib/python2.6/site-packages/ansible/plugins/action/ **init**.py”, line 565, in \_execute\_module  
(module\_style, shebang, module\_data, module\_path) = self.\_configure\_module(module\_name=module\_name, module\_args=module\_args, task\_vars=task\_vars)  
File “/usr/lib/python2.6/site-packages/ansible/plugins/action/ **init**.py”, line 153, in \_configure\_module  
task\_vars=task\_vars, module\_compression=self.\_play\_context.module\_compression)  
File “/usr/lib/python2.6/site-packages/ansible/executor/module\_common.py”, line 772, in modify\_module  
(module\_data, module\_style, shebang) = \_find\_snippet\_imports(module\_name, module\_data, module\_path, module\_args, task\_vars, module\_compression)  
File “/usr/lib/python2.6/site-packages/ansible/executor/module\_common.py”, line 640, in \_find\_snippet\_imports  
recursive\_finder(module\_name, module\_data, py\_module\_names, py\_module\_cache, zf)  
File “/usr/lib/python2.6/site-packages/ansible/executor/module\_common.py”, line 441, in recursive\_finder  
tree = ast.parse(data)  
File “/usr/lib64/python2.6/ast.py”, line 37, in parse  
return compile(expr, filename, mode, PyCF\_ONLY\_AST)  
File “”, line 16

^  
SyntaxError: invalid syntax

fatal: [localhost]: FAILED! =\> {  
“failed”: true  
}

MSG:

Unexpected failure during module execution.

`

I’ve noticed that my /usr/bin/ansible has a hash bang of /usr/bin/python2.6. My python alternatives is pointing to 2.7. I have tried changing to 2.6 to no avail.

I also think it’s weird that in the stack trace above, everything is using /usr/lib right up until the end when ast.py is in /usr/lib64. Maybe that’s normal.

Any ideas on what the problem might be?
