From c5c83e36a241a0efa22f64849ae1b79c3444604a Mon Sep 17 00:00:00 2001 From: Jean-Marc Le Roux Date: Mon, 21 Aug 2017 22:47:34 +0200 Subject: [PATCH 1/2] Fix broken reference to openldap_server_pkgs. --- tasks/install_ldap.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tasks/install_ldap.yml b/tasks/install_ldap.yml index c2aba5e..6f72393 100644 --- a/tasks/install_ldap.yml +++ b/tasks/install_ldap.yml @@ -5,13 +5,12 @@ - name: Install the openldap and required Packages for RedHat yum: name={{ item }} state=installed - with_items: openldap_server_pkgs + with_items: "{{ openldap_server_pkgs }}" when: ansible_os_family == 'RedHat' - - name: Install the openldap and required Packages for Ubuntu apt: name={{ item }} state=installed update_cache=yes - with_items: openldap_server_pkgs + with_items: "{{ openldap_server_pkgs }}" environment: env when: ansible_os_family == 'Debian' From 564635ef967a0b91096b7205bbbbeaec68a7c221 Mon Sep 17 00:00:00 2001 From: Jean-Marc Le Roux Date: Tue, 22 Aug 2017 10:54:06 +0200 Subject: [PATCH 2/2] Fix "invalid credentials" error. The password is properly set in the conf. But the conf was not properly taken into account because the slapd was not restarted. The service was not restarted because it was already started upon install even if it was not supposed to. To avoid starting the service upon install, the RUNLEVEL env variable must be set to 1. That's what the `vars/main.yml` is supposed to do. But it was not used properly in tasks/install_ldap.yml and was ignored. --- tasks/install_ldap.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tasks/install_ldap.yml b/tasks/install_ldap.yml index 6f72393..dae805a 100644 --- a/tasks/install_ldap.yml +++ b/tasks/install_ldap.yml @@ -11,28 +11,27 @@ - name: Install the openldap and required Packages for Ubuntu apt: name={{ item }} state=installed update_cache=yes with_items: "{{ openldap_server_pkgs }}" - environment: env + environment: "{{ env }}" when: ansible_os_family == 'Debian' - name: Delete the configuration directory file: path={{ openldap_server_app_path }}/slapd.d state=absent - name: Generate the root password for ldap - shell: slappasswd -s {{ openldap_server_rootpw }} + shell: slappasswd -s {{ openldap_server_rootpw }} register: root_password - name: Copy the slapd.conf configuration file for Redhat template: src=slapd.conf.j2 dest={{ openldap_server_app_path }}/slapd.conf when: ansible_os_family == "RedHat" - notify: + notify: - restart slapd - name: Copy the slapd.conf configuration file template: src=slapd.conf_ubuntu.j2 dest={{ openldap_server_app_path }}/slapd.conf when: ansible_os_family == "Debian" - notify: + notify: - restart slapd - name: Copy the ldap.conf configuration file template: src=ldap.conf.j2 dest={{ openldap_server_app_path }}/ldap.conf -