diff --git a/apps/ops/ansible/runner.py b/apps/ops/ansible/runner.py index ebac415b5..a25d681b9 100644 --- a/apps/ops/ansible/runner.py +++ b/apps/ops/ansible/runner.py @@ -250,7 +250,7 @@ class CommandRunner(AdHocRunner): results_callback_class = CommandResultCallback modules_choices = ('shell', 'raw', 'command', 'script', 'win_shell') - def execute(self, cmd, pattern, module='raw'): + def execute(self, cmd, pattern, module='shell'): if module and module not in self.modules_choices: raise AnsibleError("Module should in {}".format(self.modules_choices)) diff --git a/apps/ops/models/command.py b/apps/ops/models/command.py index 4a4c9e552..819acc3d5 100644 --- a/apps/ops/models/command.py +++ b/apps/ops/models/command.py @@ -86,6 +86,8 @@ class CommandExecution(OrgModelMixin): host = self.hosts.first() if host and host.is_windows(): shell = 'win_shell' + elif host and host.is_unixlike(): + shell = 'shell' else: shell = 'raw' result = runner.execute(self.command, 'all', module=shell)