This is the script for Chef-server and search .
You will need to change your recipe, which the ambari agent installs to dynamically obtain the IP address of the ambari server.
First, you run recipes that set up your ambari server. When Chef successfully works there, it fills in some information about the node for the Chef server, including recipes and roles that have been applied to this particular node. You can go to the chef server and check the node attributes, especially the "recipes" attribute.
Now change the ambari agent recipe. I do not know what the agent configuration file looks like, but we are only interested in one line where the IP address of the main server is set.
Create a configuration file template and add it to cooking. Replace the main IP binding value with <%= @master_ip %>
Change the ambari agent recipe to set this value correctly:
source share