Skip to content

Instantly share code, notes, and snippets.

@s-hertel
Created March 6, 2020 15:20
Show Gist options
  • Save s-hertel/909f3a76c30b277a77a1ac92d9b7f6e2 to your computer and use it in GitHub Desktop.
Save s-hertel/909f3a76c30b277a77a1ac92d9b7f6e2 to your computer and use it in GitHub Desktop.
diff --git a/lib/ansible/executor/task_executor.py b/lib/ansible/executor/task_executor.py
index bda38b0bdf..e3da2fd038 100644
--- a/lib/ansible/executor/task_executor.py
+++ b/lib/ansible/executor/task_executor.py
@@ -1032,6 +1032,8 @@ class TaskExecutor:
# let action plugin override module, fallback to 'normal' action plugin otherwise
if self._shared_loader_obj.action_loader.has_plugin(self._task.action, collection_list=collections):
handler_name = self._task.action
+ elif self._shared_loader_obj.action_loader.has_plugin(self._task.abbreviated_name, collection_list=collections):
+ handler_name = self._task.abbreviated_name
elif all((module_prefix in C.NETWORK_GROUP_MODULES, self._shared_loader_obj.action_loader.has_plugin(network_action, collection_list=collections))):
handler_name = network_action
else:
diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py
index e9e31a9a92..e2accf7841 100644
--- a/lib/ansible/playbook/task.py
+++ b/lib/ansible/playbook/task.py
@@ -111,6 +111,11 @@ class Task(Base, Conditional, Taggable, CollectionSearch):
path = "%s:%s" % (self._parent._play._ds._data_source, self._parent._play._ds._line_number)
return path
+ @property
+ def abbreviated_name(self):
+ name = self.get_name()
+ return name.split('.')[-1]
+
def get_name(self):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment