diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index 2d45987314..3eace12eeb 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -1074,6 +1074,8 @@ class AnsibleModule(object): try: + if cwd: + os.chdir(cwd) cmd = subprocess.Popen(args, **kwargs) if data: