FYI, I'm running my Ansible playbook in "pull-mode" not push mode. 
Therefore, my nodes will publish the results of their task via Hipchat.

With that said, I have a task that installs RPMs. When the installs are 
successful, the nodes notify via Hipchat that the task was successfully 
run. Now, in the event that a task fails, i force it to notify hipchat w/ 
the "--force-handlers" paramter. My question, is there a way to display a 
message according to whether it fails or runs successfully? 

If I had to, I don't mind having multiple handlers because I would need to 
modify the color for fail tasks to red as suppose to the default yellow or 
green for a successful run.

This works great

# Task
- name: Install Perl modules
  command: sudo rpm -Uvh {{ rpm_repository }}/{{ item.key }}-{{ 
item.value.svn_tag }}.rpm --force
  with_dict: deploy_modules_perl
  notify: announce_hipchat

# Handler

- name: announce_hipchat
  local_action: hipchat
            from="deployment"
            token={{ hipchat_auth_token }}
            room={{ hipchat_room }}
            msg="[{{ ansible_hostname }}] Successfully installed RPMs!"
            validate_certs="no"



-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9192b3db-e42d-4b2e-bd6a-b688a2f1aa3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to