criecm.ldap_client
ldap_client
通过 LDAP (nslcd) 的 UNIX 账户(Debian, FreeBSD)
变量(默认值)
必填项
ldap_base
('') 示例: 'dc=univ,dc=fr'ldap_uri
('') 示例: 'ldaps://ldapr.univ.fr/ ldaps://ldap.univ.fr/'
检查默认值:
ldap_force_shell
('/usr/sbin/nologin') 定义为空以允许从 ldap 获取 shell,或强制使用其他 shell (默认值适合仅需账户而不允许用户登录的情况)ldap_binddn
('')ldap_bindpw
('')ldap_tls_cacert
('')ldap_passwd_ou
('ou=People')ldap_group_ou
('ou=Group')ldap_passwd_filter
('(objectClass=posixAccount)')ldap_authz_filter
(ldap_passwd_filter
)ldap_group_filter
('(objectClass=posixGroup)')ldap_min_uid
(1000)ldap_nss
(true)ldap_starttls
(false)
选填项
pam_ldap_services
([]) - 仅适用于 FreeBSD - 如果为空则无任何作用 可能需要 'login',也许是 'sshd','imap',……任何你需要的 pam 服务ldap_validnames
('') 参见man nslcd.conf
ldap_autofs
(False) 在 nslcd.conf 中允许自动挂载 nss
示例剧本
- 对于登录机器:
- hosts: mymachines
roles:
- criecm.ldap_client
vars:
ldap_base: dc=univ,dc=fr
ldap_uri: 'ldaps://myldap.mydomain ldaps://myldapbackup.mydomain'
x509_ca_path: /etc/ssl/myca.crt
x509_ca_file: files/ca.crt
ldap_tls_cacert: '{{x509_ca_path}}'
ldap_tls_reqcert: 'demand'
ldap_force_shell: /bin/bash
- 对于邮件服务器:
- hosts: mailsrv
roles:
- criecm.ldap_client
- 邮件服务器角色
vars:
ldap_base: dc=univ,dc=fr
ldap_uri: 'ldaps://myldap.mydomain ldaps://myldapbackup.mydomain'
x509_ca_path: /etc/ssl/myca.crt
x509_ca_file: files/ca.crt
ldap_tls_cacert: '{{x509_ca_path}}'
ldap_tls_reqcert: 'demand'
ldap_passwd_filter: ('(&(objectClass=inetMailRecipient)(mail=*@mydomain))')
pam_ldap_services: [ dovecot, imap, submission ]