diff --git a/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-etc-ossec-server.conf.j2 b/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-etc-ossec-server.conf.j2
index 99201c29..a3dcbb46 100644
--- a/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-etc-ossec-server.conf.j2
+++ b/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-etc-ossec-server.conf.j2
@@ -502,7 +502,7 @@
{% endif %}
{% endif %}
{% if localfile.format == 'json' and localfile.labels is defined %}
- {% for key, value in localfile.labels.iteritems() %}
+ {% for key, value in localfile.labels.items() %}
{% endfor %}
{% endif %}
@@ -540,7 +540,7 @@
{% endif %}
{% endif %}
{% if localfile.format == 'json' and localfile.labels is defined %}
- {% for key, value in localfile.labels.iteritems() %}
+ {% for key, value in localfile.labels.items() %}
{% endfor %}
{% endif %}
@@ -579,7 +579,7 @@
{% endif %}
{% endif %}
{% if localfile.format == 'json' and localfile.labels is defined %}
- {% for key, value in localfile.labels.iteritems() %}
+ {% for key, value in localfile.labels.items() %}
{% endfor %}
{% endif %}
diff --git a/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-etc-shared-agent.conf.j2 b/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-etc-shared-agent.conf.j2
index 77e64fbf..dd1c8d9a 100644
--- a/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-etc-shared-agent.conf.j2
+++ b/roles/wazuh/ansible-wazuh-manager/templates/var-ossec-etc-shared-agent.conf.j2
@@ -68,7 +68,7 @@
{% endif %}
{% endif %}
{% if localfile.format == 'json' and localfile.labels is defined %}
- {% for key, value in localfile.labels.iteritems() %}
+ {% for key, value in localfile.labels.items() %}
{% endfor %}
{% endif %}