- name: Install packages apt: name: nslcd state: present - name: Configure NSLCD copy: src: nslcd.conf dest: /etc/nslcd.conf owner: root group: nslcd mode: '0640' backup: yes - name: Add LDAP password to NSLCD configuration lineinfile: dest: /etc/nslcd.conf regexp: "{{item.regexp}}" line: "{{item.line}}" state: present with_items: - regexp: "^bindpw" line: "bindpw {{ bindpw_password }}" - name: Configure nsswitch to use NSLCD lineinfile: dest: /etc/nsswitch.conf regexp: "{{item.regexp}}" line: "{{item.line}}" state: present with_items: - regexp: "^passwd:" line: "passwd: files systemd ldap" - regexp: "^group:" line: "group: files systemd ldap" - name: Reconfigure PAM to use LDAP shell: pam-auth-update --enable ldap - name: Restart NSLCD service service: name: nslcd state: restarted