Clarify blockinfile docs for insertafter/insertbefore (#69396)

* Clarify blockinfile docs for insertafter/insertbefore

It's not clear from the docs that these options take effect
only when no marker lines are found in the document.

* Add changelog fragment
This commit is contained in:
David Shrewsbury 2020-06-16 14:48:08 -04:00 committed by GitHub
parent 7ef0fd1c08
commit fc448ea54f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- blockinfile - Update module documentation to clarify insertbefore/insertafter usage.

View file

@ -35,7 +35,7 @@ options:
marker: marker:
description: description:
- The marker line template. - The marker line template.
- C({mark}) will be replaced with the values C(in marker_begin) (default="BEGIN") and C(marker_end) (default="END"). - C({mark}) will be replaced with the values in C(marker_begin) (default="BEGIN") and C(marker_end) (default="END").
- Using a custom marker without the C({mark}) variable may result in the block being repeatedly inserted on subsequent playbook runs. - Using a custom marker without the C({mark}) variable may result in the block being repeatedly inserted on subsequent playbook runs.
type: str type: str
default: '# {mark} ANSIBLE MANAGED BLOCK' default: '# {mark} ANSIBLE MANAGED BLOCK'
@ -48,7 +48,7 @@ options:
aliases: [ content ] aliases: [ content ]
insertafter: insertafter:
description: description:
- If specified, the block will be inserted after the last match of specified regular expression. - If specified and no begin/ending C(marker) lines are found, the block will be inserted after the last match of specified regular expression.
- A special value is available; C(EOF) for inserting the block at the end of the file. - A special value is available; C(EOF) for inserting the block at the end of the file.
- If specified regular expression has no matches, C(EOF) will be used instead. - If specified regular expression has no matches, C(EOF) will be used instead.
type: str type: str
@ -56,7 +56,7 @@ options:
default: EOF default: EOF
insertbefore: insertbefore:
description: description:
- If specified, the block will be inserted before the last match of specified regular expression. - If specified and no begin/ending C(marker) lines are found, the block will be inserted before the last match of specified regular expression.
- A special value is available; C(BOF) for inserting the block at the beginning of the file. - A special value is available; C(BOF) for inserting the block at the beginning of the file.
- If specified regular expression has no matches, the block will be inserted at the end of the file. - If specified regular expression has no matches, the block will be inserted at the end of the file.
type: str type: str