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:
parent
a1a5a2b1de
commit
455aff8436
1 changed files with 13 additions and 0 deletions
|
@ -52,6 +52,10 @@ options:
|
||||||
U(http://docs.python.org/2/library/re.html).
|
U(http://docs.python.org/2/library/re.html).
|
||||||
Uses multiline mode, which means C(^) and C($) match the beginning
|
Uses multiline mode, which means C(^) and C($) match the beginning
|
||||||
and end respectively of I(each line) of the file.
|
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:
|
replace:
|
||||||
required: false
|
required: false
|
||||||
description:
|
description:
|
||||||
|
@ -141,6 +145,15 @@ EXAMPLES = r"""
|
||||||
regexp: '^(NameVirtualHost|Listen)\s+80\s*$'
|
regexp: '^(NameVirtualHost|Listen)\s+80\s*$'
|
||||||
replace: '\1 127.0.0.1:8080'
|
replace: '\1 127.0.0.1:8080'
|
||||||
validate: '/usr/sbin/apache2ctl -f %s -t'
|
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
|
import os
|
||||||
|
|
Loading…
Reference in a new issue