From 0b0ca9573185c10849ca9b820637b217303821d8 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Wed, 12 Mar 2014 10:10:45 -0400 Subject: [PATCH] Expand environment variables and tildes passed to commands generically across the board. --- lib/ansible/module_utils/basic.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index 6e47dd4560d..8bdfb0b976e 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -1018,6 +1018,9 @@ class AnsibleModule(object): msg = "Argument 'args' to run_command must be list or string" self.fail_json(rc=257, cmd=args, msg=msg) + # expand things like $HOME and ~ + args = [ os.path.expandvars(os.path.expanduser(x)) for x in args ] + rc = 0 msg = None st_in = None