Skip to content

Commit

Permalink
docs: add 'inserting hosts' section in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Izquierdo committed Feb 7, 2024
1 parent 73e0974 commit 972272f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/host_limit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,26 @@ Event data example:
The value for "hosts" can be a comma delimited string of multiple host names, but typically
it is a single host. This is useful to restrict a remedy playbook to run only on the problematical host
that emits a monitored event. Be sure that the source plugin already sends this metadata.


Inserting hosts to meta
-----------------------

The plugins may not send metadata like for example the `ansible.eda.webhook` plugin which
sends the arbitrary payload under the `payload` key.

To accommodate this, the EDA collection provides the `insert_hosts_to_meta` filter,
allowing any plugin to customize the value of `event.meta.hosts`` based on the contents
of a specific key in the event.

Example:

.. code-block:: yaml
sources:
- ansible.eda.webhook:
port: 4444
host: 0.0.0.0
filters:
- ansible.eda.insert_hosts_to_meta:
host_path: "payload.meta.hosts"

0 comments on commit 972272f

Please sign in to comment.