From 4c9ebe8522fd8ccd33f9d777a7659f6029ce7da2 Mon Sep 17 00:00:00 2001 From: Serge van Ginderachter Date: Fri, 24 May 2013 22:10:46 +0200 Subject: [PATCH] Add roles support for the script module allows to put scripts directly in a dir within the role: roles//scripts/.. Same as the copy and template module. As requested in and closes #2969 --- lib/ansible/runner/action_plugins/script.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/runner/action_plugins/script.py b/lib/ansible/runner/action_plugins/script.py index b86d9c3f1d..8794c343c5 100644 --- a/lib/ansible/runner/action_plugins/script.py +++ b/lib/ansible/runner/action_plugins/script.py @@ -41,7 +41,10 @@ class ActionModule(object): # FIXME: error handling args = " ".join(tokens[1:]) source = template.template(self.runner.basedir, source, inject) - source = utils.path_dwim(self.runner.basedir, source) + if '_original_file' in inject: + source = utils.path_dwim_relative(inject['_original_file'], 'scripts', source, self.runner.basedir) + else: + source = utils.path_dwim(self.runner.basedir, source) # transfer the file to a remote tmp location source = source.replace('\x00','') # why does this happen here?