diff --git a/templates/haproxy_cfg b/templates/haproxy_cfg
index 22f5bb463c7fa322dc562df138f3dfaafdd497d4..ebd32bbb420b6b2e52fb88e67c974dccbc3fd593 100644
--- a/templates/haproxy_cfg
+++ b/templates/haproxy_cfg
@@ -99,7 +99,7 @@ backend backend_{{host}}
 {% if varnish_host|default(false) %}
 
 backend backend_varnish
-{% if varnish_host == inventory_host %}
+{% if varnish_host == inventory_hostname %}
   server varnish 127.0.0.1:6081 maxconn 32
 {% else %}
   server varnish {{ hostvars[varnish_host]['static_ipv4']|default(hostvars[varnish_host]['ansible_default_ipv4']['address']) }}:6081 maxconn 32