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 outputs Unknown Job for ambari-agent

Solved Go to solution

Ansible outputs Unknown Job for ambari-agent

Contributor

I am getting following error:

fatal: [node4.hc.com]: FAILED! => {"changed": false, "failed": true, "msg": "stop: Unknown job: ambari-agent\nstart: Unknown job: ambari-agent\n"}

fatal: [node2.hc.com]: FAILED! => {"changed": false, "failed": true, "msg": "stop: Unknown job: ambari-agent\nstart: Unknown job: ambari-agent\n"}

and role is :

--- - hosts: all

tasks:

- name: Install Ambari agent

yum: name=ambari-agent state=present

- name: Configure ambari-server hostname in ambari-agent configuration

lineinfile: dest=/etc/ambari-agent/conf/ambari-agent.ini regexp=^.*hostname=.*$ line=hostname={{ item }} backup=yes with_items: "{{groups['ambari']}}"

- name: Ensure ambari-agent is running and enabled

service: name=ambari-agent state=started enabled=yes

Why is it not able to find the service ?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Ansible outputs Unknown Job for ambari-agent

Contributor

I couldn't figure out that why ambari-agent module was not being recognize but i managed to use script from init.d to start the service and it worked.

Here is the snippet of the play:

---

name: Ensure ambari-agent is running and enabled

command: /etc/init.d/ambari-agent restart

View solution in original post

5 REPLIES 5
Highlighted

Re: Ansible outputs Unknown Job for ambari-agent

Guru

Hi @Bhavin Tandel ,

are all the other steps running fine ? maybe posting the whole output will help....

I have similar playbook, which works fine on RHEL

- name: install ambari-agent yum: name=ambari-agent state=latest 
...
- name: Ensure ambari-agent is running and enabled 
service: name=ambari-agent state=restarted enabled=yes

guessing you are on a RHEL based distro...

What if you do a manual "service ambari-agent restart" ?!?!

Highlighted

Re: Ansible outputs Unknown Job for ambari-agent

Contributor

Thanks @Gerd Koenig for the quick reply. This the whole output, and yeah i am on Centos 6.5. If i run the command manually then it executed successfully.6262-conemu64-2016-08-02-14-18-49.png

Highlighted

Re: Ansible outputs Unknown Job for ambari-agent

Contributor

I couldn't figure out that why ambari-agent module was not being recognize but i managed to use script from init.d to start the service and it worked.

Here is the snippet of the play:

---

name: Ensure ambari-agent is running and enabled

command: /etc/init.d/ambari-agent restart

View solution in original post

Highlighted

Re: Ansible outputs Unknown Job for ambari-agent

Expert Contributor

Hi @Bhavin Tandel

This is a valid question.

Ambari 2.2.1.1 introduced a bug, by adding upstart support on all flavours of Linux: https://issues.apache.org/jira/browse/AMBARI-14842

Unfortunately, the same /etc/init/ambari-agent.conf file was used for all flavours of Linux. And in CentOS/RHEL6, the line 'kill signal SIGKILL' from this file is not compatible with the older version of upstart used in CentOS/RHEL6.

Ansible service module would always prefer to use upstart instead of SysVinit to start services, hence the error, as the upstart stop/start ambari-agent does not work in CentOS/RHEL6.

This is fixed in Ambari 2.2.2.0 so I suggest you use Ambari 2.2.2.0. If you can't, then you'll need to use the following Ansible task before your service task:

- name: Fix for upstart script in RHEL6
  lineinfile: dest=/etc/init/ambari-agent.conf
              state=absent
              regexp='^kill(.*)'
  when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "6"

Kind regards,

Alexandru

Highlighted

Re: Ansible outputs Unknown Job for ambari-agent

Contributor

Thanks @Alexandru Anghel

This was very informative

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