Tried to write a line using lineinfule module sequentially were observed that the random lines are missed to write on the file.
serial: 100 become: True
gather_facts: False tasks:
- name: Executing script
script: scripts/getDisksData.py
register: disk_data
tags:
- run_script
- get_disk_data
- set_fact: disk_data="{{inventory_hostname }} {{ disk_data.stdout_lines[0] }}"
tags:
- run_script
- get_disk_data
- name: Write Disks Data to file
lineinfile: line={{ disk_data }} dest=working_dir/{{ app_id }}_instance_disk_data.txt insertafter=EOF state=present
delegate_to: localhost
tags:
- run_script
- get_disk_dataEXPECTED RESULTS
Passed 4 ips to the inventory so 4 entries should be made on the file.
ACTUAL RESULTS
Got 2 entries on the first attempt.
Got 4 entries on second attempt.