ansible/roles/ldap/nss/tasks/main.yml
2019-06-10 21:05:08 +03:00

41 lines
715 B
YAML

---
- name: install packages
package:
name: "{{ item }}"
state: installed
with_items:
- nscd
- nss-pam-ldapd
- name: configure nsswitch to use ldap
lineinfile:
path: /etc/nsswitch.conf
regexp: "^{{ item }}:.*"
line: "{{ item }}: files ldap"
with_items:
- passwd
- shadow
- group
- name: allow nslcd user to read host key
user:
name: nslcd
groups: hostkey
- name: create nslcd config
template:
dest: /etc/nslcd.conf
src: nslcd.conf.j2
mode: 0600
owner: root
group: root
notify: restart nslcd
- name: enable nslcd and nscd
service:
name: "{{ item }}"
enabled: true
state: started
with_items:
- nslcd
- nscd