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

88 views
Skip to first unread message

Rob White

unread,
Jan 24, 2017, 1:45:47 AM1/24/17
to Ansible Project
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 "<unknown>", 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?
Reply all
Reply to author
Forward
0 new messages