diff options
Diffstat (limited to 'lib/ansible/plugins/action/script.py')
-rw-r--r-- | lib/ansible/plugins/action/script.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/ansible/plugins/action/script.py b/lib/ansible/plugins/action/script.py index 000b2951f1..76e0d5c9f7 100644 --- a/lib/ansible/plugins/action/script.py +++ b/lib/ansible/plugins/action/script.py @@ -79,6 +79,9 @@ class ActionModule(ActionBase): parts = [to_text(s, errors='surrogate_or_strict') for s in shlex.split(raw_params.strip())] source = parts[0] + # Support executable paths and files with spaces in the name. + executable = to_native(self._task.args.get('executable', ''), errors='surrogate_or_strict') + try: source = self._loader.get_real_file(self._find_needle('files', source), decrypt=self._task.args.get('decrypt', True)) except AnsibleError as e: @@ -109,7 +112,11 @@ class ActionModule(ActionBase): # add preparation steps to one ssh roundtrip executing the script env_dict = dict() env_string = self._compute_environment_string(env_dict) - script_cmd = ' '.join([env_string, target_command]) + + if executable: + script_cmd = ' '.join([env_string, executable, target_command]) + else: + script_cmd = ' '.join([env_string, target_command]) if self._play_context.check_mode: raise _AnsibleActionDone() |