updated epel
diff --git a/defaults/main.yml b/defaults/main.yml
index 6001348..c2835c4 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -8,7 +8,7 @@
 openldap_support:
 - http://ftp.altlinux.org/pub/distributions/ALTLinux/Sisyphus/x86_64/RPMS.classic/libsasl2-3-2.1.26-alt7.x86_64.rpm
 
-openldap_2_4_40:
+openldap_downgrade_version:
 - openldap-2.4.40
 - openldap-clients-2.4.40
 - openldap-servers-2.4.40
@@ -34,3 +34,32 @@
 - { src: "/lib64/libldap_r-2.4.so.2.10.3", path: "/lib64/libldap_r-2.4.so.2" }
 
 #ftp://195.220.108.108/linux/centos/6.9/os/x86_64/Packages/cyrus-sasl-lib-2.1.23-15.el6_6.2.i686.rpm
+
+openldap_named_versions:
+- http://mirror.centos.org/centos/6/os/x86_64/Packages/openldap-2.4.40-16.el6.x86_64.rpm
+- http://mirror.centos.org/centos/6/os/x86_64/Packages/openldap-clients-2.4.40-16.el6.x86_64.rpm
+- http://mirror.centos.org/centos/6/os/x86_64/Packages/openldap-servers-2.4.40-16.el6.x86_64.rpm
+- http://mirror.centos.org/centos/6/os/x86_64/Packages/compat-openldap-2.3.43-2.el6.x86_64.rpm
+
+# Additional packages to add to the openldap_named_versions collection
+#- http://mirror.centos.org/centos/6/os/x86_64/Packages/libtool-ltdl-2.2.6-15.5.el6.x86_64.rpm
+#- http://mirror.centos.org/centos/6/os/x86_64/Packages/libstdc++-4.4.7-11.el6.x86_64.rpm
+#- http://mirror.centos.org/centos/6/os/x86_64/Packages/libuuid-2.17.2-12.18.el6.x86_64.rpm
+#- http://mirror.centos.org/centos/6/os/x86_64/Packages/boost-filesystem-1.41.0-25.el6.x86_64.rpm
+#- http://mirror.centos.org/centos/6/os/x86_64/Packages/boost-program-options-1.41.0-25.el6.x86_64.rpm
+#- http://mirror.centos.org/centos/6/os/x86_64/Packages/boost-system-1.41.0-25.el6.x86_64.rpm
+#- http://mirror.centos.org/centos/6/os/x86_64/Packages/boost-test-1.41.0-25.el6.x86_64.rpm
+#- http://mirror.centos.org/centos/6/os/x86_64/Packages/uuid-1.6.1-10.el6.x86_64.rpm
+#- http://mirror.centos.org/centos/6/os/x86_64/Packages/libaio-0.3.107-10.el6.x86_64.rpm
+#- http://mirror.centos.org/centos/6/os/x86_64/Packages/nspr-4.13.1-1.el6.x86_64.rpm
+#- http://mirror.centos.org/centos/6/os/x86_64/Packages/nss-3.27.1-13.el6.x86_64.rpm
+#- http://mirror.centos.org/centos/6/os/x86_64/Packages/nss-util-3.27.1-3.el6.x86_64.rpm
+#- http://mirror.centos.org/centos/6/os/x86_64/Packages/cyrus-sasl-ldap-2.1.23-15.el6_6.2.x86_64.rpm
+#- http://mirror.centos.org/centos/6/os/x86_64/Packages/cyrus-sasl-lib-2.1.23-15.el6_6.2.x86_64.rpm
+#- http://mirror.centos.org/centos/6/os/x86_64/Packages/glibc-2.12-1.209.el6.x86_64.rpm
+#- http://mirror.centos.org/centos/6/os/x86_64/Packages/compat-db42-4.2.52-17.el6.x86_64.rpm
+#- http://mirror.centos.org/centos/6/os/x86_64/Packages/compat-db-4.6.21-17.el6.x86_64.rpm
+#- http://mirror.centos.org/centos/6/os/x86_64/Packages/db4-4.7.25-22.el6.x86_64.rpm
+#- http://mirror.centos.org/centos/6/os/x86_64/Packages/db4-devel-4.7.25-22.el6.x86_64.rpm
+#- http://mirror.centos.org/centos/6/os/x86_64/Packages/db4-utils-4.7.25-22.el6.x86_64.rpm
+#- http://mirror.centos.org/centos/6/os/x86_64/Packages/db4-cxx-4.7.25-22.el6.x86_64.rpm
diff --git a/tasks/main.yml b/tasks/main.yml
index fa8a5ac..c41a5bd 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -1,20 +1,91 @@
 ---
 # tasks file for apigee-opdk-setup-os-openldap
 
-- name: Do not use proxy definitions
-  include: with_no_proxy.yml
-  when: http_proxy is not defined and https_proxy is not defined
+#- name: Do not use proxy definitions
+#  include: with_no_proxy.yml
+#  when: http_proxy is not defined and https_proxy is not defined
+#
+#- name: Use proxy definitions
+#  include: with_proxy.yml
+#  when: http_proxy is defined and https_proxy is defined
 
-- name: Use proxy definitions
-  include: with_proxy.yml
-  when: http_proxy is defined and https_proxy is defined
+- block:
+
+  - name: Install openldap packages if needed
+    become: yes
+    yum:
+      name: "{{ item }}"
+      state: present
+      allow_downgrade: yes
+    with_items: "{{ openldap }}"
+    when: opdk_version | version_compare('4.17.05', '>')
+    environment:
+      http_proxy: "{{ http_proxy }}"
+      https_proxy: "{{ https_proxy }}"
+      no_proxy: "{{ no_proxy }}"
+
+  rescue:
+
+    - block:
+
+      - name: Downgrade openldap packages if needed
+        become: yes
+        yum:
+          name: "{{ item }}"
+          state: present
+          allow_downgrade: yes
+        with_items: "{{ openldap_downgrade_version }}"
+        when:  opdk_version | version_compare('4.17.09', '<')
+        environment:
+          http_proxy: "{{ http_proxy }}"
+          https_proxy: "{{ https_proxy }}"
+          no_proxy: "{{ no_proxy }}"
 
 
-# Keep as we may need it as a manual backup, wait before implementing
-#wget ftp://fr2.rpmfind.net/linux/centos/7.3.1611/os/x86_64/Packages/openldap-2.4.40-13.el7.x86_64.rpm
-#wget ftp://fr2.rpmfind.net/linux/centos/7.3.1611/os/x86_64/Packages/openldap-servers-2.4.40-13.el7.x86_64.rpm
-#wget ftp://fr2.rpmfind.net/linux/centos/7.3.1611/os/x86_64/Packages/openldap-clients-2.4.40-13.el7.x86_64.rpm
-#yum downgrade openldap-2.4.40-13.el7.x86_64.rpm -y
-#yum install openldap-servers-2.4.40-13.el7.x86_64.rpm -y
-#yum install openldap-clients-2.4.40-13.el7.x86_64.rpm -y
-#gee-openldap -yyum install api
\ No newline at end of file
+      rescue:
+        - block:
+
+          - name: Installed named version
+            yum:
+              name: "{{ item }}"
+              state: present
+            with_items: "{{ openldap_named_versions }}"
+            environment:
+              http_proxy: "{{ http_proxy }}"
+              https_proxy: "{{ https_proxy }}"
+              no_proxy: "{{ no_proxy }}"
+
+
+          rescue:
+            - name: Install the remainder openldap manually
+              shell: "rpm -ivh --oldpackage {{ openldap_named_versions }}"
+              environment:
+                http_proxy: "{{ http_proxy }}"
+                https_proxy: "{{ https_proxy }}"
+                no_proxy: "{{ no_proxy }}"
+
+
+      become: yes
+      when: opdk_version | version_compare('4.17.05', '<=') and ansible_distribution_major_version | version_compare("6", ">" )
+
+#- block:
+#  - name: Update LDAP dependent libraries
+#    file:
+#      force: yes
+#      state: link
+#      src: "{{ item.src }}"
+#      path: "{{ item.path }}"
+#    with_items: "{{ ldap_dependent_library_links }}"
+
+#  rescue:
+
+#        - name: Update LDAP dependent libraries
+#          file:
+#            force: yes
+#            state: link
+#            src: "{{ item.src }}"
+#            path: "{{ item.path }}"
+#          with_items: "{{ ldap_dependent_library_links }}"
+
+#  when: opdk_version | version_compare('4.17.01', '>=') and opdk_version | version_compare('4.17.05', '<=')
+
diff --git a/tasks/with_no_proxy.yml b/tasks/with_no_proxy.yml
index 07f9135..2198cfd 100644
--- a/tasks/with_no_proxy.yml
+++ b/tasks/with_no_proxy.yml
@@ -9,6 +9,10 @@
       allow_downgrade: yes
     with_items: "{{ openldap }}"
     when: opdk_version | version_compare('4.17.05', '>')
+    environment:
+      http_proxy: "{{ http_proxy }}"
+      https_proxy: "{{ https_proxy }}"
+      no_proxy: "{{ no_proxy }}"
 
   rescue:
 
@@ -22,6 +26,11 @@
           allow_downgrade: yes
         with_items: "{{ openldap_downgrade_version }}"
         when:  opdk_version | version_compare('4.17.09', '<')
+        environment:
+          http_proxy: "{{ http_proxy }}"
+          https_proxy: "{{ https_proxy }}"
+          no_proxy: "{{ no_proxy }}"
+
 
       rescue:
         - block:
@@ -31,10 +40,20 @@
               name: "{{ item }}"
               state: present
             with_items: "{{ openldap_named_versions }}"
+            environment:
+              http_proxy: "{{ http_proxy }}"
+              https_proxy: "{{ https_proxy }}"
+              no_proxy: "{{ no_proxy }}"
+
 
           rescue:
             - name: Install the remainder openldap manually
               shell: "rpm -ivh --oldpackage {{ openldap_named_versions }}"
+              environment:
+                http_proxy: "{{ http_proxy }}"
+                https_proxy: "{{ https_proxy }}"
+                no_proxy: "{{ no_proxy }}"
+
 
       become: yes
       when: opdk_version | version_compare('4.17.05', '<=') and ansible_distribution_major_version | version_compare("6", ">" )