Elastic Alerting + Ansible Tower

Is there a way to send an alert to Ansible Tower which will trigger an ansible playbook?

I was considering the webhook connector but it appears that Ansible Tower currently provides webhook integration with GitHub and GitLab. So not sure if I am not understanding this or perhaps there is another method?

Yeah, it looks like Ansible Tower does a good job making sure the "easy" webhook setup only works for Gitlab and Github.

That being said, a webhook is normally just a GET or POST request with a specific JSON body. With AWX/Tower you can launch a job by initiating a POST request to https://TOWERSERVER/api/v2/job_templates/{TEMPLATE_ID}/launch/?format=api with credentials.

I have not tested this so your mileage may vary but you may be able to setup the webhook pointed at your job template and it might just work. I believe the body of the request should appear as extra_vars for your job but you will want to review ansible tower API documentation to be sure.

Someone with access to modify the webhook url may be able to launch other job templates so keep this in mind as you think about the surface area between the two tools.

1 Like

Thank you!

I think this method might be the best possible way to do this. I also found there's a different approach with using Elastic for Event Driven Ansible.
Demo: Using Event-Driven Ansible with Elasticsearch logs!