From bc2430694c152311eb7768227ab9ce54a1c99715 Mon Sep 17 00:00:00 2001 From: Aleks Date: Fri, 25 May 2018 19:49:46 +0200 Subject: [PATCH] Add a note for multible changes in one file (#37090) As mentioned in this answer https://stackoverflow.com/a/41549694/6778826 we was able to solve a bad behaviour of `blockinfile` module. We must change two parts in one file which we have done in two tasks. Every run have rewriten the first block with the second block in the wrong position. **After** we have set the `marker` in the second task to another value was the `blockinfile` module able to insert both parts in the right position in the same file. --- lib/ansible/modules/files/blockinfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ansible/modules/files/blockinfile.py b/lib/ansible/modules/files/blockinfile.py index 16b2b741e4f..4022a8df494 100644 --- a/lib/ansible/modules/files/blockinfile.py +++ b/lib/ansible/modules/files/blockinfile.py @@ -95,6 +95,7 @@ notes: - When using 'with_*' loops be aware that if you do not set a unique mark the block will be overwritten on each iteration. - As of Ansible 2.3, the I(dest) option has been changed to I(path) as default, but I(dest) still works as well. - Option I(follow) has been removed in version 2.5, because this module modifies the contents of the file so I(follow=no) doesn't make sense. + - When more then one block should be handled in **one** file you **must** change the I(marker) per task """ EXAMPLES = r"""