diff --git a/changelogs/fragments/67832-run_powershell_modules_on_windows_containers.yml b/changelogs/fragments/67832-run_powershell_modules_on_windows_containers.yml new file mode 100644 index 00000000000..faddb90a09e --- /dev/null +++ b/changelogs/fragments/67832-run_powershell_modules_on_windows_containers.yml @@ -0,0 +1,2 @@ +minor_changes: + - docker connection plugin - run Powershell modules on Windows containers. diff --git a/lib/ansible/plugins/connection/docker.py b/lib/ansible/plugins/connection/docker.py index 118434ad41a..380a84d877d 100644 --- a/lib/ansible/plugins/connection/docker.py +++ b/lib/ansible/plugins/connection/docker.py @@ -76,6 +76,10 @@ class Connection(ConnectionBase): # configured to be connected to by root and they are not running as # root. + # Windows uses Powershell modules + if getattr(self._shell, "_IS_WINDOWS", False): + self.module_implementation_preferences = ('.ps1', '.exe', '') + if 'docker_command' in kwargs: self.docker_cmd = kwargs['docker_command'] else: