diff --git a/templates/etc_hosts.jinja2 b/templates/etc_hosts.jinja2
index 177f6ca78166dc1f09bd84383b5fa52473ae760f..be52347720b34516a379d2b3a1ec64591a3d43d8 100644
--- a/templates/etc_hosts.jinja2
+++ b/templates/etc_hosts.jinja2
@@ -34,6 +34,7 @@ ff02::2	  ip6-allrouters
 {% endif %}
 {% if ip %}
 {{ ip }} {{ host }}
+{% if drupal_domains_in_hosts|default(true) %}
 {% for drupal in hostvars[host]['drupal_settings']|default([]) %}
 {% for domain in drupal.domains|default([]) %}
 {{ ip }} {{ domain.domain }}
@@ -44,6 +45,7 @@ ff02::2	  ip6-allrouters
 {% endfor %}
 {% endif %}
 {% endif %}
+{% endif %}
 {% endfor %}
 
 {% if commonauth_extras is defined %}