lineinfile - Add alternative backrefs example to docs (#69844)
* lineinfile - Add alternative backrefs example to docs * Add changelog
This commit is contained in:
parent
2dbd5dc2ae
commit
f5718a354c
2 changed files with 10 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- lineinfile - add example of using alternative backrefs syntax (https://github.com/ansible/ansible/issues/42794)
|
|
@ -200,6 +200,14 @@ EXAMPLES = r'''
|
||||||
regexp: '^%ADMIN ALL='
|
regexp: '^%ADMIN ALL='
|
||||||
line: '%ADMIN ALL=(ALL) NOPASSWD: ALL'
|
line: '%ADMIN ALL=(ALL) NOPASSWD: ALL'
|
||||||
validate: /usr/sbin/visudo -cf %s
|
validate: /usr/sbin/visudo -cf %s
|
||||||
|
|
||||||
|
# See https://docs.python.org/3/library/re.html for further details on syntax
|
||||||
|
- name: Use backrefs with alternative group syntax to avoid conflicts with variable values
|
||||||
|
lineinfile:
|
||||||
|
path: /tmp/config
|
||||||
|
regexp: ^(host=).*
|
||||||
|
line: \g<1>{{ hostname }}
|
||||||
|
backrefs: yes
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
Loading…
Reference in a new issue