I'm trying to find if a file has had any writes in the last 15 seconds.
- name: 'Check File for Writes'
shell: tail -n 50 /path/to/some/file | sha1sum
loop:
- 1
- 2
register: file_writes
loop_control:
pause: 15
until: file_writes.results[0].stdout == file_writes.results[1].stdout
The expected behavior is as follows:
1.) This task would run the 'tail' command once
2.) It would then wait for 15 seconds
3.) Then run the 'tail' command again
4.) The outputs of both tail commands would be registered in 'file_writes'.results
5.) Steps 1 through 4 would be looped until the first 'tail' command's hash matches the second 'tail' commands' hash.
The actual result:
'dict object' has no attribute results.
It is possible to put all the logic into a script