diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 800e44d3f85eb07f1024f2c2d07bea30f1562a63..46da4e670c2b31f82e3ba221735a6a514a5cc47c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -12,6 +12,7 @@ variables:
   ANSIBLE_CALLBACK_RESULT_FORMAT: "yaml"
   ANSIBLE_DISPLAY_SKIPPED_HOSTS: "0"
   ANSIBLE_FORCE_COLOR: "1"
+  ANSIBLE_INJECT_FACT_VARS: "0"
   ANSIBLE_REMOTE_TMP: "/tmp"
   ANSIBLE_SHELL_ALLOW_WORLD_READABLE_TEMP: "1"
   DEBIAN_FRONTEND: noninteractive
diff --git a/tasks/apt.yml b/tasks/apt.yml
index 78a7acdb7e3bf746649c3bef10a8bf17534d196c..545f62b0c464a814790f800e86750d08ab4d3929 100644
--- a/tasks/apt.yml
+++ b/tasks/apt.yml
@@ -83,7 +83,7 @@
                     signed_by: /usr/share/keyrings/icinga-archive-keyring.gpg
                     suites: "icinga-{{ ansible_facts.distribution_release }}"
                     types: deb
-                    uris: "https://packages.icinga.com/{{ ansible_distribution | lower }}"
+                    uris: "https://packages.icinga.com/{{ ansible_facts.distribution | lower }}"
                   check_mode: true
                   changed_when: false
                   register: icinga_sources_check
@@ -123,7 +123,7 @@
                 signed_by: /usr/share/keyrings/icinga-archive-keyring.gpg
                 suites: "icinga-{{ ansible_facts.distribution_release }}"
                 types: deb
-                uris: "https://packages.icinga.com/{{ ansible_distribution | lower }}"
+                uris: "https://packages.icinga.com/{{ ansible_facts.distribution | lower }}"
               register: icinga_sources
 
           when: icinga_archive_keyring_pub_key.stat.exists | bool
@@ -197,7 +197,7 @@
                 gpg --dearmor < /root/icinga.asc > /etc/apt/keyrings/icinga.gpg
                 chmod 644 /etc/apt/keyrings/icinga.gpg
               args:
-                executable: "{{ ansible_local.bash.path }}"
+                executable: "{{ ansible_facts.ansible_local.bash.path }}"
               when: ( icinga_tmp_asc_file.changed | bool ) or ( not icinga_gpg_file.stat.exists | bool )
 
             - name: Stat Icinga gpg dearmored file
@@ -207,18 +207,18 @@
 
             - name: Debug disto
               ansible.builtin.debug:
-                var: ansible_distribution
+                var: ansible_facts.distribution
                 verbosity: 2
 
             - name: Debug disto version
               ansible.builtin.debug:
-                var: ansible_distribution_version
+                var: ansible_facts.distribution_version
                 verbosity: 2
 
             - name: Icinga gpg key check command
               ansible.builtin.command: >
                 gpg --with-colons
-                {% if ansible_local.gpg.version is version('2.2.12', '<') %}
+                {% if ansible_facts.ansible_local.gpg.version is version('2.2.12', '<') %}
                 --with-fingerprint --with-subkey-fingerprint
                 {% else %}
                 --show-keys
@@ -236,8 +236,8 @@
                 quiet: "{% if ansible_verbosity == 0 %}true{% else %}false{% endif %}"
               when:
                 - ansible_loop.first | bool
-                - ansible_distribution == "Debian"
-                - ansible_distribution_version is version('10', '<')
+                - ansible_facts.distribution == "Debian"
+                - ansible_facts.distribution_version is version('10', '<')
               loop: "{{ icinga_gpg_fingerprints }}"
               loop_control:
                 extended: true
@@ -250,8 +250,8 @@
                 quiet: "{% if ansible_verbosity == 0 %}true{% else %}false{% endif %}"
               when:
                 - ansible_loop.first | bool
-                - ansible_distribution == "Ubuntu"
-                - ansible_distribution_version is version('18.04', '<=')
+                - ansible_facts.distribution == "Ubuntu"
+                - ansible_facts.distribution_version is version('18.04', '<=')
               loop: "{{ icinga_gpg_fingerprints }}"
               loop_control:
                 extended: true
@@ -263,8 +263,8 @@
                   - icinga_fpr in icinga_gpg.stdout
                 quiet: "{% if ansible_verbosity == 0 %}true{% else %}false{% endif %}"
               when: >
-                ( ( ansible_distribution == "Debian" ) and ( ansible_distribution_version is version('10', '>=') ) ) or
-                ( ( ansible_distribution == "Ubuntu" ) and ( ansible_distribution_version is version('18.04', '>') ) )
+                ( ( ansible_facts.distribution == "Debian" ) and ( ansible_facts.distribution_version is version('10', '>=') ) ) or
+                ( ( ansible_facts.distribution == "Ubuntu" ) and ( ansible_facts.distribution_version is version('18.04', '>') ) )
               loop: "{{ icinga_gpg_fingerprints }}"
               loop_control:
                 loop_var: icinga_fpr
diff --git a/tasks/firewall.yml b/tasks/firewall.yml
index 06519bba6fbc79ba686624ce164e2f00a459e9d5..77166f1310f3ad47086bd48f7b9f3ccef5c9849c 100644
--- a/tasks/firewall.yml
+++ b/tasks/firewall.yml
@@ -74,8 +74,8 @@
       ansible.builtin.include_tasks: iptables.yml
       when:
         - icinga_port_state != "open"
-        - ( "iptables-persistent" in ansible_local.dpkg.installed )
-        - ( "ufw" not in ansible_local.dpkg.installed )
+        - ( "iptables-persistent" in ansible_facts.ansible_local.dpkg.installed )
+        - ( "ufw" not in ansible_facts.ansible_local.dpkg.installed )
 
     - name: Include the UFW role when port 5665 is not open on the agent mode
       ansible.builtin.include_role:
@@ -86,7 +86,7 @@
             from_ip: "{{ icinga_master_node_ipv4 }}"
       when:
         - icinga_port_state != "open"
-        - ( "ufw" in ansible_local.dpkg.installed )
+        - ( "ufw" in ansible_facts.ansible_local.dpkg.installed )
 
   tags:
     - icinga
diff --git a/templates/host.conf.j2 b/templates/host.conf.j2
index eeb457998b0efac141a53b2033e85d157e7b7721..5d3a5809d2e9c7a3ed447f19e170dcf9a3c034e5 100644
--- a/templates/host.conf.j2
+++ b/templates/host.conf.j2
@@ -10,10 +10,10 @@ object Host "{{ icinga_host }}" {
 
 {% if icinga_remote_node is defined and not icinga_remote_node | bool %}
 {%     if hostvars[icinga_host]['ansible_system'] is defined %}
-  vars.os = "{{ hostvars[icinga_host]['ansible_system'] }}"
+  vars.os = "{{ hostvars[icinga_host]['ansible_facts']['system'] }}"
 {%     endif %}
-{%     if hostvars[icinga_host]['ansible_os_family'] is defined %}
-  vars.os_family = "{{ hostvars[icinga_host]['ansible_os_family'] }}"
+{%     if hostvars[icinga_host]['ansible_facts']['os_family'] is defined %}
+  vars.os_family = "{{ hostvars[icinga_host]['ansible_facts']['os_family'] }}"
 {%     endif %}
 {% endif %}