Event handler using ansible

Hi All,

I know, I have ask this question before, but to my surprise I don’t find any better documentation on internet which can say how I can use mandible as a EDI tool (event driven infra).

We have nagios in our environment and use awx for automation. I already have more to 50 templates and workflow for automating some basic tasks. Now I need to make ansible to listen to nagios events and based on the events ansible should trigger jobs.

  1. I am not sure if my ask is possible.
  2. if its possible, can some one guide me with some good documentation

Thanks
Sathya.R

Hi Sathya

yes this is possible. You can use ansible-runner [1] to do this, but you'll need
to do some work in python to deal with getting events out from nagios.

I am using this setup with rabbitmq as an event source and it works nicely.

[1]: https://ansible-runner.readthedocs.io/en/latest/python_interface.html#usage-examples

The general approach is that you have a "main" python function that listens
to your event stream from nagios, and if you see something interesting, then
kick off an ansible runner.

Concurrency is not python's strong point so bear in mind what might happen
if you have multiple matching events arriving in a short space of time.

A+
Dave

Thanks dave, I will take a look it ansible-runner.