diff --git a/smartgears/ckan_connector/templates/ckan-web.xml.j2 b/smartgears/ckan_connector/templates/ckan-web.xml.j2
index a20ce21..9df7ec3 100644
--- a/smartgears/ckan_connector/templates/ckan-web.xml.j2
+++ b/smartgears/ckan_connector/templates/ckan-web.xml.j2
@@ -9,7 +9,11 @@
hostname
- {{ ansible_fqdn }}
+ {% if hostname is defined %}
+ {{ hostname }}
+ {% else %}
+ {{ smartgears_hostname }}
+ {% endif %}
internalPort