diff --git a/roles/wazuh/ansible-wazuh-agent/templates/var-ossec-etc-ossec-agent.conf.j2 b/roles/wazuh/ansible-wazuh-agent/templates/var-ossec-etc-ossec-agent.conf.j2
index 6327441a6..bfcf86e40 100644
--- a/roles/wazuh/ansible-wazuh-agent/templates/var-ossec-etc-ossec-agent.conf.j2
+++ b/roles/wazuh/ansible-wazuh-agent/templates/var-ossec-etc-ossec-agent.conf.j2
@@ -291,6 +291,9 @@
{% if localfile.format == 'command' or localfile.format == 'full_command' %}
{{ localfile.command }}
{{ localfile.frequency }}
+ {% if localfile.alias is defined %}
+ {{ localfile.alias }}
+ {% endif %}
{% else %}
{{ localfile.location }}
{% endif %}
@@ -305,6 +308,9 @@
{% if localfile.format == 'command' or localfile.format == 'full_command' %}
{{ localfile.command }}
{{ localfile.frequency }}
+ {% if localfile.alias is defined %}
+ {{ localfile.alias }}
+ {% endif %}
{% else %}
{{ localfile.location }}
{% endif %}
@@ -319,6 +325,9 @@
{% if localfile.format == 'command' or localfile.format == 'full_command' %}
{{ localfile.command }}
{{ localfile.frequency }}
+ {% if localfile.alias is defined %}
+ {{ localfile.alias }}
+ {% endif %}
{% else %}
{{ localfile.location }}
{% endif %}