Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How do I automate setting up LDAP in Ambari?

avatar

I need to automate the process of setting up LDAP in ambari server. I do use EXPECT script for it. Here is my sample_backup.exp file:

#!/usr/bin/expect
spawn ambari-server setup-ldap
expect "Primary URL* {host:port} :"
send "<host>:<port>\r"
expect "Secondary URL {host:port} :"
send " \r"
expect "Use SSL* [true/false] (false):"
send "false\r"
expect "User object class* (posixAccount):"
send "person\r"
expect "User name attribute* (uid):"
send "uid\r"
expect "Group object class* (posixGroup):"
send "groupOfUniqueNames\r"
expect "Group name attribute* (cn):"
send "cn\r"
expect "Group member attribute* (memberUid):"
send "uniqueMember\r"
expect "Distinguished name attribute* (dn):"
send "dn\r"
expect "Base DN* :"
send "<base_dn>\r"
expect "Referral method [follow/ignore] :"
send "ignore\r"
expect "Bind anonymously* [true/false] (false):"
send "false\r"
expect "Manager DN* :"
send "<manager_dn>\r"
expect "Enter Manager Password* :"
send "<manager_password>\r"
expect "Re-enter password:"
send "<manager_password>\r"
expect "Save settings [y/n]"
send "y\r"
expect eof

When running the above I am getting:

[root@dkhdp251 expect_app]# expect sample_backup.exp
spawn ambari-server setup-ldap
Using python  /usr/bin/python
Setting up LDAP properties...
Primary URL* {host:port} : <host>:<port>
Secondary URL {host:port} : invalid command name "true/false"
    while executing
"true/false"
    invoked from within
"expect "Use SSL* [true/false] (false):""
    (file "sample_backup.exp" line 7)

Any ideas of what wrong is?

1 ACCEPTED SOLUTION

avatar
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login
1 REPLY 1

avatar
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login