multiple changes using lineinfile

21 views
Skip to first unread message

Santosh Jambhlikar

unread,
Sep 29, 2015, 9:55:25 AM9/29/15
to Ansible Project
I am trying to make 2 different changes in one file  but only last change is getting updated ... Looks like ansible holds the file in memory (after first change) and never dump it back to disk as it knows there is/are  more change (s) to be made as per .yml file. so when it is making change (second)  in the same file (but on disks ) and while processing it , file in memory is getting replaced with newer version. So first change was done but never closed/completed/dumped back to disk.

There should be some mechanism to 'close' the file after each change but did not see it on ansible docs. Anyone aware?


P.S. - The same be accomplished by using different tasks but i don't want to use (may need 15-20 changes in a file so don't want same number of tasks)

Santosh Jambhlikar

unread,
Sep 29, 2015, 1:48:54 PM9/29/15
to Ansible Project
Please note: there are 2 different changes (otherwise i could have written it - and it works) . first change is to replace a line and the another one is insert a line  but on the same file.

On Tuesday, 29 September 2015 19:25:25 UTC+5:30, Santosh Jambhlikar wrote 
Reply all
Reply to author
Forward
0 new messages