diff --git a/lib/ansible/runner/action_plugins/raw.py b/lib/ansible/runner/action_plugins/raw.py
index 88040f2648..5904331102 100644
--- a/lib/ansible/runner/action_plugins/raw.py
+++ b/lib/ansible/runner/action_plugins/raw.py
@@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see .
-import shlex
+import re
import ansible.constants as C
from ansible import utils
@@ -30,13 +30,13 @@ class ActionModule(object):
def run(self, conn, tmp, module_name, module_args, inject):
executable = None
- args = []
- for arg in shlex.split(module_args.encode("utf-8")):
- if arg.startswith('executable='):
- executable = arg.split('=', 1)[1]
- else:
- args.append(arg)
- module_args = ' '.join(args)
+ # From library/command, keep in sync
+ r = re.compile(r'(^|\s)(executable)=(?P[\'"])?(.*?)(?(quote)(?