add role ldap/nss

This commit is contained in:
Timo Makinen 2019-06-10 21:05:08 +03:00
parent 998dc0b643
commit 9fc02e7bef
3 changed files with 77 additions and 0 deletions

View file

@ -0,0 +1,41 @@
---
- 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