<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question How do I automate setting up LDAP in Ambari? in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-do-I-automate-setting-up-LDAP-in-Ambari/m-p/139947#M56248</link>
    <description>&lt;P&gt;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:&lt;/P&gt;&lt;PRE&gt;#!/usr/bin/expect
spawn ambari-server setup-ldap
expect "Primary URL* {host:port} :"
send "&amp;lt;host&amp;gt;:&amp;lt;port&amp;gt;\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 "&amp;lt;base_dn&amp;gt;\r"
expect "Referral method [follow/ignore] :"
send "ignore\r"
expect "Bind anonymously* [true/false] (false):"
send "false\r"
expect "Manager DN* :"
send "&amp;lt;manager_dn&amp;gt;\r"
expect "Enter Manager Password* :"
send "&amp;lt;manager_password&amp;gt;\r"
expect "Re-enter password:"
send "&amp;lt;manager_password&amp;gt;\r"
expect "Save settings [y/n]"
send "y\r"
expect eof
&lt;/PRE&gt;&lt;P&gt;When running the above I am getting:&lt;/P&gt;&lt;PRE&gt;[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} : &amp;lt;host&amp;gt;:&amp;lt;port&amp;gt;
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)
&lt;/PRE&gt;&lt;P&gt;Any ideas of what wrong is?&lt;/P&gt;</description>
    <pubDate>Mon, 06 Mar 2017 18:46:50 GMT</pubDate>
    <dc:creator>dkozlowski</dc:creator>
    <dc:date>2017-03-06T18:46:50Z</dc:date>
    <item>
      <title>How do I automate setting up LDAP in Ambari?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-do-I-automate-setting-up-LDAP-in-Ambari/m-p/139947#M56248</link>
      <description>&lt;P&gt;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:&lt;/P&gt;&lt;PRE&gt;#!/usr/bin/expect
spawn ambari-server setup-ldap
expect "Primary URL* {host:port} :"
send "&amp;lt;host&amp;gt;:&amp;lt;port&amp;gt;\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 "&amp;lt;base_dn&amp;gt;\r"
expect "Referral method [follow/ignore] :"
send "ignore\r"
expect "Bind anonymously* [true/false] (false):"
send "false\r"
expect "Manager DN* :"
send "&amp;lt;manager_dn&amp;gt;\r"
expect "Enter Manager Password* :"
send "&amp;lt;manager_password&amp;gt;\r"
expect "Re-enter password:"
send "&amp;lt;manager_password&amp;gt;\r"
expect "Save settings [y/n]"
send "y\r"
expect eof
&lt;/PRE&gt;&lt;P&gt;When running the above I am getting:&lt;/P&gt;&lt;PRE&gt;[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} : &amp;lt;host&amp;gt;:&amp;lt;port&amp;gt;
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)
&lt;/PRE&gt;&lt;P&gt;Any ideas of what wrong is?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 18:46:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-do-I-automate-setting-up-LDAP-in-Ambari/m-p/139947#M56248</guid>
      <dc:creator>dkozlowski</dc:creator>
      <dc:date>2017-03-06T18:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do I automate setting up LDAP in Ambari?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-do-I-automate-setting-up-LDAP-in-Ambari/m-p/139948#M56249</link>
      <description>&lt;P&gt;I have got it working now. Here it is what I have changed:&lt;/P&gt;&lt;PRE&gt;I.
FROM
expect "Use SSL* [true/false] (false):"

TO
expect "Use SSL* (false):"

II.
FROM
expect "Referral method [follow/ignore] :"

TO
expect "Referral method :"

III.
FROM
expect "Bind anonymously* [true/false] (false):"

TO
expect "Bind anonymously* (false):"

IV.
FROM
expect "Save settings [y/n]"

TO
expect "Save settings "
&lt;/PRE&gt;&lt;P&gt;Now, when running the script I have this:&lt;/P&gt;&lt;PRE&gt;[root@dkhdp251 expect_app]# expect sample_new.exp 
spawn ambari-server setup-ldap 
Using python /usr/bin/python 
Setting up LDAP properties... 
Primary URL* {host:port} : &amp;lt;host&amp;gt;:&amp;lt;port&amp;gt; 
Secondary URL {host:port} : 
Use SSL* [true/false] (false): false 
User object class* (posixAccount): person 
User name attribute* (uid): uid 
Group object class* (posixGroup): groupOfUniqueNames 
Group name attribute* (cn): cn 
Group member attribute* (memberUid): uniqueMember 
Distinguished name attribute* (dn): dn 
Base DN* : &amp;lt;base_dn&amp;gt; 
Referral method [follow/ignore] : ignore 
Bind anonymously* [true/false] (false): false 
Manager DN* : &amp;lt;manager_dn&amp;gt; 
Enter Manager Password* : 
Re-enter password: 
==================== 
Review Settings 
==================== 
authentication.ldap.managerDn: &amp;lt;manager_dn&amp;gt; 
authentication.ldap.managerPassword: ***** 
Save settings [y/n] (y)? y 
Saving...done 
Ambari Server 'setup-ldap' completed successfully. 
&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Mar 2017 19:20:12 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-do-I-automate-setting-up-LDAP-in-Ambari/m-p/139948#M56249</guid>
      <dc:creator>dkozlowski</dc:creator>
      <dc:date>2017-03-06T19:20:12Z</dc:date>
    </item>
  </channel>
</rss>

