lineinfile - Add alternative backrefs example to docs (#69844)

* lineinfile - Add alternative backrefs example to docs

* Add changelog
This commit is contained in:
Sam Doran 2020-06-04 17:13:42 -04:00 committed by GitHub
parent 2dbd5dc2ae
commit f5718a354c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- lineinfile - add example of using alternative backrefs syntax (https://github.com/ansible/ansible/issues/42794)

View file

@ -200,6 +200,14 @@ EXAMPLES = r'''
regexp: '^%ADMIN ALL='
line: '%ADMIN ALL=(ALL) NOPASSWD: ALL'
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