roumano.ldap_client
需求
- 可选: 定义一个变量 domainname 用于更新 /etc/hosts,包含 LDAP 服务器的 IP 和 主机名 hostname.domainename
group_vars/inventory.yml 的示例
---
ldap:
ssl: exemple_ca.crt
server: "ldaps://ldap1/,ldaps://ldap2/"
base: "dc=exemple,dc=com"
bind: "cn=readonly"
servers:
- hostname: ldap1
ip: 10.0.0.1
- hostname: ldap2
ip: 10.0.0.2
domainname: 'aws.edifixio.com'
使用示例:
- { role: ldap_client , when: ldap is defined and ldap.base is defined and ldap.server is defined }
- 安装所需的 ldap 软件包 sssd-ldap, sssd-tools, sudo (在 Debian 系列) authconfig, sssd-ldap, sssd-tools, sudo, openldap-clients (在 RedHat 系列)
- 如果有,推送 SSL 证书
- 更新 /etc/hosts,添加 LDAP 服务器
- 更新 /etc/nsswitch.conf(添加 sss)
- 在机器启动时启用 sssd 服务
- 执行 authconfig(在 RedHat 系列)以配置 pam 等
- 执行 pam-auth-update(在 Debian 系列)以配置 pam
- 启用通过 pam_mkhomedir.so 在首次连接时创建主目录(在 Debian 系列)
- 配置 /etc/openldap/ldap.conf 以设置 ldapsearch 的默认 ldap 参数
- SSHD: 将 AuthorizedKeysCommand 和 AuthorizedKeysCommandUser 添加到 /etc/ssh/sshd_config,以从 LDAP 获取 SSH 密钥