I am automating the process of recovery of a failed host in a cluster(using python), and I need to add a host to the cluster then I will install components on that.
Ambari has API to add a host e.g.
requests.post(" http://<ambari-host-IP>:<port>/api/v1/clusters/<CLUSTERNAME>/hosts/<HOSTNAME>", auth=self.auth, headers=self.headers, proxies=self.proxyDict)
but it dosent takes ssh key and password.
I dont want to explicitly install abmari agent using YUM(and changing agent.ini config file)because server version and agent version may not match.
Do we have a way to add ssh key and ssh password to above post command.
Or, is there any other automated way to add and register a host to an existing cluster through a python prograam ?
Using ambari api/ post command you will not able to install/register new host to the cluster.
To achieve this you need to write custom python script and get the steps done as mentioned in - https://cwiki.apache.org/confluence/display/AMBARI/Add+a+host+and+deploy+components+using+APIs
@Sagar Shimpi Many thanks for your reply, but the page u refereed, starts with "Ensure the host is registered properly"
and, I need a way to register a host with ssh key and password, so that ambari server can install ambari agent on new host.
without ssh key and password, ambari server fails to to so, In ambari UI there is an option to put a ssh key and password but how to do that using curl command ?
@Rahul Pathak I already tried this, but after submitting bootstrap request, it never returns a failure or success response, I always get a running status, although, I carried on further and saw that ambari agent was installed successfully(despite of not getting a failure/success response). And like this my job is done. 🙂