diff options
author | Felix Fontein <felix@fontein.de> | 2020-03-03 02:14:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-02 17:14:13 -0800 |
commit | e379dc76c34f068996381fe51204626d3acf6146 (patch) | |
tree | 83c9a1ecb7d1b68abd9275b46c37398aa9203a75 | |
parent | 3fb4d109cefb05992150de8d3cc3b03fcef14250 (diff) | |
download | ansible-e379dc76c34f068996381fe51204626d3acf6146.tar.gz |
Run Powershell modules on windows container via docker connection (#67832) (#67872)
* Run modules on windows container
This provides an ability to run Powershell modules on windows container via docker connection. Otherwise, Ansible tries to run python modules on windows containers and fails.
* Removing whitespace in the blank lines
* Adding a changelog fragment
(cherry picked from commit e0eee3c37e8e802113d5c3c41681b1cf4af7b0e9)
Co-authored-by: Ruheena Ansari <ruheena0105@tamu.edu>
-rw-r--r-- | changelogs/fragments/67832-run_powershell_modules_on_windows_containers.yml | 2 | ||||
-rw-r--r-- | lib/ansible/plugins/connection/docker.py | 4 |
2 files changed, 6 insertions, 0 deletions
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 0000000000..faddb90a09 --- /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 118434ad41..380a84d877 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: |