From 14a9c3ab9e7e101afcd7bfcaccf1b1cbd8964aeb Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Fri, 7 Sep 2012 21:03:30 -0400 Subject: [PATCH] Line in file regexep should match a portion of the line, not the whole line! --- library/lineinfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/lineinfile b/library/lineinfile index 7675bb04818..c183bb918d5 100755 --- a/library/lineinfile +++ b/library/lineinfile @@ -27,8 +27,8 @@ def present(module, name, regexp, line, insertafter, backup): f.close() mre = re.compile(regexp) - if not mre.match(line): - module.fail_json(msg="line= doesn't match regexp=") + if not mre.search(line): + module.fail_json(msg="usage error: line= doesn't match regexp (%s)" % regexp) if insertafter in ('BOF', 'EOF'): iare = None