lineinfile module in ansible not updating all changes -
i trying make 2 different changes in 1 file last change getting updated ... looks ansible holds file in memory (after first change) , never dump disk knows there is/are more change (s) made per .yml file. when making second change in same file (but 1 on disks ) , while processing , older file in memory getting replaced newer version. first change done never closed/completed/dumped disk.
there should mechanism 'close' file after each change did not see on ansible docs. aware?
i noticed same kind of change can looped doesn't accept different 2 different types of changes.
p.s. - same accomplished using different tasks don't want use (may need 15-20 changes in file don't want same number fi trying make 2 different changes in 1 file last change getting updated ... looks ansible holds file in memory (after first change) , never dump disk knows there is/are more change (s) made per .yml file. when making change (second) in same file (but on disks ) , while processing , file in memory getting replaced newer version. first change done never closed/completed/dumped disk.
there should mechanism 'close' file after each change did not see on ansible docs. aware? first change- insert text in file. second change- replace text in same file.
p.s. - same accomplished using different tasks don't want use (may need 15-20 changes in file don't want same number of tasks)of tasks)
if running on same file, you'll need run playbook --forks=1
or -f 1
in:
ansible-playbook -i hosts playbook.yml --forks=1
the default 5 forks (or whatever have set in ansible.cfg). forks can overwrite each other's changes.
Comments
Post a Comment