Skip to main content
sshimpi
Silver ⭐️⭐️⭐️
Dec 25, 2016 3:18 PM UTC

How to automate ldap-sync for ambari

  • Oct 5, 2026 9:08 AM UTC
  • 1 reply
  • 2196 views
  • Translate All

1. Installed expect first:

# yum install expect -y

(or use your Linux distribution's package manager if you're not Using CentOS or RHEL)

2. Then create and run the following expect script:

# cat /tmp/ambari-server-sync-ldap-unattended.sh
#!/usr/bin/expect
set timeout 20
spawn /usr/sbin/ambari-server sync-ldap --groups=/etc/ambari-server/ambari-groups.csv
expect "Enter Ambari Admin login:" { send "admin\n" }
expect "Enter Ambari Admin password:" { send "notTheRealPasswordOfCourse\n" }
interact

3. If customer wants password to NOT be in plain text, ask them to look at something like Ansible which handles decrypting passwords from a file.

1 reply

abhishek_c
Silver ⭐️⭐️⭐️
Jul 18, 2018 1:29 AM UTC

Hi Sagar,

Thank you for providing details on automating the ldap-sys. It worked wonderfully.

Thanks,

Abhishek

Translate