diff --git a/client/templates/hosts.j2 b/client/templates/hosts.j2
index 8d6e15a0ba28b9da9d6b267ae90cce860869f395..53bd1f04585c0fe112aa17e320f24c83ef466716 100644
--- a/client/templates/hosts.j2
+++ b/client/templates/hosts.j2
@@ -1,5 +1,5 @@
 127.0.0.1	localhost
-127.0.1.1	{{ inventory_hostname }}.{{ domain[0] }}	{{ inventory_hostname }}
+127.0.1.1	{{ inventory_hostname }}.{{ domain }}	{{ inventory_hostname }}
 
 # The following lines are desirable for IPv6 capable hosts
 ::1     localhost ip6-localhost ip6-loopback