Updated to better manage remote ldap
diff --git a/tasks/ldap.yml b/tasks/ldap.yml
index 9cdf88d..7466f0c 100644
--- a/tasks/ldap.yml
+++ b/tasks/ldap.yml
@@ -5,6 +5,11 @@
     value: "{{ hostvars[groups['dc-1-ms'][0]][interface_name].ipv4.address }}"
   when: groups['dc-1'] is defined and groups['dc-1-ms'] is defined and groups['dc-1-ldap'] is not defined and inventory_hostname in groups['dc-1'] and hostvars[groups['dc-1-ms'][0]][interface_name].ipv4.address is defined
 
+- name: Clear ldap type
+  cache:
+    key: opdk_ldap_type
+    value: ''
+
 - block:
   - name: Normalized name for ldap ip when ldap is a declared if on dc-1
     cache:
@@ -15,13 +20,14 @@
     cache:
       key: use_opdk_ldap_remote_host
       value: 'y'
+    when: ldap_ip != local_mgmt_ip
 
-  - name: Set ldap remote flag
+  - name: Set ldap port
     cache:
       key: opdk_ldap_port
       value: '{{ ldap_data_port }}'
 
-  - name: Set ldap flag
+  - name: Set ldap type
     cache:
       key: opdk_ldap_type
       value: 2
@@ -50,13 +56,14 @@
     cache:
       key: use_opdk_ldap_remote_host
       value: 'y'
+    when: ldap_ip != local_mgmt_ip
 
-  - name: Set ldap remote flag
+  - name: Set ldap port
     cache:
       key: opdk_ldap_port
       value: '{{ ldap_data_port }}'
 
-  - name: Set ldap remote flag
+  - name: Set ldap type
     cache:
       key: opdk_ldap_type
       value: 2
diff --git a/tasks/main.yml b/tasks/main.yml
index 0c3ded2..de3928e 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -14,6 +14,7 @@
 
 - include_tasks: local_mgmt_ip.yml
 
+# local_mgmt_ip.yml must run before ldap
 - include_tasks: ldap.yml
 
 - include_tasks: public_mgmt_ip.yml