How is it possible to tail a file located at several remote servers in a known location using ansible? This question is based on this comment on this Hacker News thread:
In my company, we have hundred machines and tailing done with ansible. If we want customize the log view, we can simply edit the playbook. I think it is very handy compared to we need additional npm package (and not to mention additional effort for customization).
You can use ansible ad-hoc :
ansible atlanta -a "tail /homedir/myfile" -f 10
UPDATE
Ansible can only print the output after completing the command. That's why I think what you want is not possible, ansible is probably not the tool you want for this job. Check issue 4870 and 3887.
If you really want to use ansible to do this, there is hack posted in one of issues (haven't tested and actually I don't recommend it).
I really don't know what the guy from HN was talking about, maybe just tail
(without the -f
)?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With