I’m trying to create an action plugin, and I’ve simplified it to a very basic demonstration of this issue. When my action module calls another module with self._execute_module
, the task fails reporting that the module being called is missing interpreter line
. Here’s a minimal example:
action_plugins/basic.py
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.action import ActionBase
class ActionModule(ActionBase):
def __init__(self, *args, **kwargs):
super(ActionModule, self).__init__(*args, **kwargs)
def run(self, tmp=None, task_vars=None):
super(ActionModule, self).run(tmp, task_vars)
return self._execute_module(
module_name='ansible.builtin.debug',
module_args={'msg': 'testing'},
task_vars=task_vars,
)
test_task.yml
- name: Test action module
gather_facts: false
hosts: localhost
tasks:
- name: Test action module
basic: {}
And when running this basic task, I get the failure:
fatal: [localhost]: FAILED! => {
"msg": "module (ansible.builtin.debug) is missing interpreter line"
}
I’ve tried different shebang options in my action plugin with no changes. The error seems to originate from here, but I’m sure there’s more going on here than I understand, cause this line seems to be looking for a shebang, but none of the built in modules have shebangs.
I’m really at a loss for what’s going on here.