diff --git a/plays/re2o-ldap.yml b/plays/re2o-ldap.yml
index 33964e190a7888a10b0e305ef7e0295566bd3242..fcdd583e694a0311d1cf54c8179a7a8bcbe9810a 100755
--- a/plays/re2o-ldap.yml
+++ b/plays/re2o-ldap.yml
@@ -4,4 +4,4 @@
   vars:
     re2o_ldap: "{{ glob_re2o_ldap | default({}) | combine(loc_re2o_ldap | default({})) }}"
   roles:
-    - re2o-ldap-replica
+    - re2o-ldap
diff --git a/roles/re2o-ldap/tasks/main.yml b/roles/re2o-ldap/tasks/main.yml
index 687f13324e4a9c28353c28defa3084906fabfe30..485cf7ffe87992f648f415d2ac116452cb494a9b 100644
--- a/roles/re2o-ldap/tasks/main.yml
+++ b/roles/re2o-ldap/tasks/main.yml
@@ -77,7 +77,7 @@
     state: started
 
 - name: Enable data replication
-  when: not installation.stat.exists and re2o_ldap.replica exists
+  when: not installation.stat.exists and re2o_ldap.replica is defined
   shell: ldapadd -Q -Y EXTERNAL -H ldapi:/// -f /var/lib/slapd/replication.ldif
 
 # LDAPS configuration
diff --git a/roles/re2o-ldap/templates/ldap/replication.ldif.j2 b/roles/re2o-ldap/templates/ldap/replication.ldif.j2
index 7065c26057978edc3b3f0ccb3918383c462942a4..7b74785ccc8a55672f61b4b1296c8203402c4116 100644
--- a/roles/re2o-ldap/templates/ldap/replication.ldif.j2
+++ b/roles/re2o-ldap/templates/ldap/replication.ldif.j2
@@ -1,5 +1,6 @@
 {{ ansible_header | comment }}
 
+{% if re2o_ldap.replica is defined %}
 dn: olcDatabase={1}hdb,cn=config
 changetype: modify
 add: olcSyncrepl
@@ -19,3 +20,4 @@ olcSyncrepl: rid=1
 -
 add: olcUpdateRef
 olcUpdateRef: {{ re2o_ldap.url }}
+{% endif %}