diff --git a/lib/ansible/modules/commands/command.py b/lib/ansible/modules/commands/command.py index 50d329199c5..6baf35922c2 100644 --- a/lib/ansible/modules/commands/command.py +++ b/lib/ansible/modules/commands/command.py @@ -178,6 +178,7 @@ def main(): module.fail_json(rc=256, msg="no command given") if chdir: + chdir = os.path.abspath(os.path.expanduser(chdir)) os.chdir(chdir) if creates: