Here's how I set the fact...
# Create the local facts directory if it doesn't exist
- name: ensure that the local facts directory exists
file: state=directory path="/etc/ansible/facts.d" mode=0755
# Set a local fact so that we don't do this again
- name: update the widget facts file so that this is not run next time.
ini_file: dest=/etc/ansible/facts.d/widgets.fact section=installed
option=version value={{ widgets_latest_version }} mode=0644
and in my case I add the following to all of the actual widget installation tasks so that I don't reinstall (not quite your scenario)
when: "widgets_installed_version != widgets_latest_version"
and in that role I have a defaults/main.yml which sets these...
widgets_installed_version: "{{ ansible_local.widgets.installed.version | default(0) }}"
widgets_latest_version: "latest"
In your case you won't need to check those local facts (unless you want to) but you can set as many facts as you want. The last modified time of the /etc/ansible/facts.d/widgets.fact file will tell you when it was last changed. If you rerun the playbook with the same version it will not update that time, if you store other facts you may also want to store times with them if they are all in the same facts file.
I hope that this helps,
Adam