Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Ansible Ambari cluster creation

Highlighted

Ansible Ambari cluster creation

Hi

I've been working with ansible to create hadoop clusters, everything works fine except ambari agents fail to connect to ambari server. Even though ambari agents are in running state and that ambari-agent.ini file is updated with ambari-servers hostname, versions also match. I've written the ansible playbook in such a way that ambari-server tries to connect with ambari-agents for 200 times with 5 second delay, but at the end of the loop it fails. If I manually log in into each agent machine and restart the agents during the 200 tries, it gets connected with the server.

Thanks in advance!!

5 REPLIES 5
Highlighted

Re: Ansible Ambari cluster creation

Super Mentor

@Sujatha Veeswar

You mentioned that you have written the ansible playbook in such a way that ambari-server tries to connect with ambari-agents for 200 times with 5 second delay.

- > However, Ideally the ambari-agent tries to connect to ambari-server based on the host/port and other information's mentioned in "ambari-agent.ini".Ambari agents sends their registration requests to ambari-server.

- If you want to connect from ambari-server to ambari-agents then you should check if the agent hostnames are resolvable from ambari hosts? Also from ambari-server how are you connecting to ambari agents? (I Mean which agent port? And is that port accessible form AmbariServer)

Highlighted

Re: Ansible Ambari cluster creation

@Jay SenSharma

So ideally ambari-agent.ini file should contain the ambari-server's hostname and /etc/hosts file must contain dns of both server and agent machines which was provided..

FYR..

ambari-agent.ini

[server]

hostname=ambari_server_hostname

url_port=8440

secured_url_port=8441

Is it required to provide the ambari-agent's hostname in the ambari-agent.ini file..?

Highlighted

Re: Ansible Ambari cluster creation

Super Mentor

@Sujatha Veeswar

No we do not need to provide ambari-agents hostname inside the "ambari-agent.ini" file. It should only know what are the AmbariServer host/port information's are.

.

From ambari-server how are you connecting to ambari agents? (I Mean which agent port? And is that port accessible form AmbariServer)

Re: Ansible Ambari cluster creation

This is the part of ansible playbook..

- name: Waiting for ambari-agents to register
  uri: url="http://{{ ansible_default_ipv4.address }}:8080/api/v1/hosts/{{ hostvars[item]['ansible_fqdn'] | lower }}"
       method=GET
       force_basic_auth=yes
       user=admin
       password=admin
       HEADER_X-Requested-By="ambari"
       status_code=200,201,202,404
  with_items: "{{ groups['all'] }}"
  register: result
  until: "result.status != 404"
  retries: 200
  delay: 5
Highlighted

Re: Ansible Ambari cluster creation

Super Mentor

@Sujatha Veeswar

How are you making sure that your Ansible is actually starting the ambari-agent properly?

Are you having the following code in your Ansible:

name: Ensure ambari-agent is running and enabled
command: /etc/init.d/ambari-agent restart

.

Don't have an account?
Coming from Hortonworks? Activate your account here