Share value between hosts in playbook

Hi,
I need to do the following thing.
On the first host, calculate the checksum of a certain file (es. /etc/hosts) and save it into a variable, let’s say “file_checksum”.
On the second host, I would like to calculate newly the checksum and compare it with the one from the first host (i.e. the value saved in “file_checksum”). And so on with the other hosts of my inventory.
I tried several ways without success. Also run_once on set_fact doesn’t seem to work (see below the snippet not fully working).
Any Idea how to save a value between hosts in a playbook?
Thanks in advance.
Cheers.
Gaetano

You can share values between hosts using the hostvars[host_name] variable, however I believe in your situation you’ll want to run this in separate plays, as these task will still run on all of your systems (just one system at a time, due to the serial use).