From fa463fb1b74b89f8b7f3d74f5e59c0d230bd62b4 Mon Sep 17 00:00:00 2001 From: "Federico G. Schwindt" Date: Sun, 14 Dec 2014 22:53:21 +0000 Subject: [PATCH] Allow globbing in creates= and removes= directives Fixes 1904 --- lib/ansible/modules/commands/command.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/commands/command.py b/lib/ansible/modules/commands/command.py index b0aa5a7b99..bc1425acaf 100644 --- a/lib/ansible/modules/commands/command.py +++ b/lib/ansible/modules/commands/command.py @@ -21,6 +21,7 @@ import copy import sys import datetime +import glob import traceback import re import shlex @@ -188,7 +189,7 @@ def main(): # and the filename already exists. This allows idempotence # of command executions. v = os.path.expanduser(creates) - if os.path.exists(v): + if glob.glob(v): module.exit_json( cmd=args, stdout="skipped, since %s exists" % v, @@ -202,7 +203,7 @@ def main(): # and the filename does not exist. This allows idempotence # of command executions. v = os.path.expanduser(removes) - if not os.path.exists(v): + if not glob.glob(v): module.exit_json( cmd=args, stdout="skipped, since %s does not exist" % v,