ported fix from ansible-core #5639

From 3d09c94faeaa52075055f23744d8b52581c59bb2 Mon Sep 17 00:00:00 2001
Evan Kaufman <evan@digitalflophouse.com>
This commit is contained in:
Brian Coca 2017-03-21 16:03:00 -04:00
parent a1a5a2b1de
commit 455aff8436

View file

@ -52,6 +52,10 @@ options:
U(http://docs.python.org/2/library/re.html).
Uses multiline mode, which means C(^) and C($) match the beginning
and end respectively of I(each line) of the file.
- Note that, as of ansible 2, short form tasks should have any escape
sequences backslash-escaped in order to prevent them being parsed
as string literal escapes. See the examples.
replace:
required: false
description:
@ -141,6 +145,15 @@ EXAMPLES = r"""
regexp: '^(NameVirtualHost|Listen)\s+80\s*$'
replace: '\1 127.0.0.1:8080'
validate: '/usr/sbin/apache2ctl -f %s -t'
- name: short form task (in ansible 2+) necessitates backslash-escaped sequences
replace: dest=/etc/hosts regexp='\\b(localhost)(\\d*)\\b' replace='\\1\\2.localdomain\\2 \\1\\2'
- name: long form task does not
replace:
dest: /etc/hosts
regexp: '\b(localhost)(\d*)\b'
replace: '\1\2.localdomain\2 \1\2'
"""
import os