diff --git a/files/etc/ansible/facts.d/rosetta_app_version.fact b/files/etc/ansible/facts.d/rosetta_app_version.fact
new file mode 100644
index 0000000000000000000000000000000000000000..f0fafdee5fda5a1d696075464effab9e65d8eac0
--- /dev/null
+++ b/files/etc/ansible/facts.d/rosetta_app_version.fact
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+# example string in global.properties file:
+# app.version=8.1.0.0
+if [[ -e "/exlibris/dps/d4_1/system.dir/conf/global.properties" ]]; then
+	ver=$( grep -r "app.version" /exlibris/dps/d4_1/system.dir/conf/global.properties | cut -d "=" -f2 );
+	echo "{\"version\" : \"${ver}\"}";
+fi
diff --git a/tasks/rosetta/main_rosetta.yml b/tasks/rosetta/main_rosetta.yml
index 68354084ce82b3f22ffc58387801c7ecf8cccb5d..651543e9e370fce83adff2cca280949d579efe52 100644
--- a/tasks/rosetta/main_rosetta.yml
+++ b/tasks/rosetta/main_rosetta.yml
@@ -1,6 +1,9 @@
 ---
 ### ROSETTA TASKS
 
+- name: prepare custom facts
+  ansible.builtin.import_tasks: "rosetta/prepare_custom_facts.yml"
+  tags: [facts]
 - name: configure iptables Rosetta
   ansible.builtin.import_tasks: "rosetta/configure_iptables_rosetta.yml"
   tags: [iptables]
diff --git a/tasks/rosetta/prepare_custom_facts.yml b/tasks/rosetta/prepare_custom_facts.yml
new file mode 100644
index 0000000000000000000000000000000000000000..11af3c99f8ab6f3b464da231ef5f03baf9441831
--- /dev/null
+++ b/tasks/rosetta/prepare_custom_facts.yml
@@ -0,0 +1,23 @@
+---
+- name: "Create custom fact directory"
+  ansible.builtin.file:
+    path: "/etc/ansible/facts.d"
+    state: "directory"
+    mode: "0755"
+
+### ATTENTION!!!
+# This custom fact script assumes that whatever app.version is set in the
+# global.properties file IS THE CORRECT ONE! The mechanism is quite trivial:
+# read the old value, set it as fact, write it to the template.
+# If the previous app.version is set incorrectly, then the new one will be as
+# well!
+# Read up on custom facts here:
+# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_vars_facts.html#adding-custom-facts
+- name: install custom fact file for getting installed Rosetta version
+  ansible.builtin.copy:
+    src: "etc/ansible/facts.d/rosetta_app_version.fact"
+    dest: "/etc/ansible/facts.d/rosetta_app_version.fact"
+    mode: "0755"
+
+- name: "Re-run setup to use custom facts"
+  ansible.builtin.setup: ~