From 972272f225d994efb7b3aa4bbc2a2323db851e0e Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 7 Feb 2024 12:42:18 +0100 Subject: [PATCH] docs: add 'inserting hosts' section in docs --- docs/host_limit.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/host_limit.rst b/docs/host_limit.rst index 95c14be75..c55ec8970 100644 --- a/docs/host_limit.rst +++ b/docs/host_limit.rst @@ -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"