查询用户和删除用户
#!/bin/bash
home_dir="/files/yaml/cam/test"
get_ldapip=`kubectl get svc -n kube-system | grep camldap-test | awk '{print $3}'`
ldapsearch -H ldap://${get_ldapip}:80 -x -b "ou=General,dc=xxx,dc=com" | grep dn | awk -F "=" '{print $2}' | egrep -v "(boss,|General,)" | awk -F "," '{print $1}' > ${home_dir}/sh/ldap_name.txt
for i in `cat ${home_dir}/sh/ldap_name.txt`
do
ldapdelete -H ldap://${get_ldapip}:80 -x -D "cn=admin,dc=xxx,dc=com" -w Oxxxx11 "cn=$i,ou=General,dc=xxx,dc=com"
done