Use this when designing event payloads with type, source, time and a unique ID.
Events · Event-Driven Automation
Events are records that something happened — an alert fired, a file arrived, a commit was pushed — usually JSON with type, source, time and details, used to trigger automation.
1. An event records that something happened.
2. Immutable facts with ID and timestamp.
3. Use a schema (CloudEvents).
4. Small payloads; fetch details if needed.
5. Document event types.
something happens → event emitted
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
Use a synthetic or captured-safe fixture to verify the full path. Confirm the source receives exactly one logical test occurrence (or deliberately test duplicates), inspect the normalized event payload, and verify the expected rule condition matches while neighboring rules do not. Record the rulebook revision and the rule/action identity selected. Then verify the action's execution and independent target outcome. Repeat with malformed, irrelevant, duplicate and out-of-order events to show non-matching and deduplication behavior. If persistence/feedback is configured, test a restart or retry path so delivery guarantees are understood rather than assumed. The evidence should trace event ID/correlation ID from source to rule to action to target read-back; a generic 'rulebook is running' status does not show event handling.
Step 2 Common mistakes Narrow the fault
- Events without IDs or timestamps.
Step 3 Where it fails Narrow the fault
Separate producer/source, transport/queue, payload normalization, rule evaluation, action invocation and target outcome. A missing action can be caused by no event arrival, schema mismatch, a false condition or rule suppression; an action can run twice because the source redelivered even when rule logic is correct. At-least-once delivery requires idempotent or deduplicated downstream behavior where duplicates are unsafe. Do not loosen rule conditions until you have showed the expected event reached the evaluator with the expected fields. Do not blame the source for a target permission failure after a rule matched correctly. Preserve an event/correlation identifier and stop diagnosis at the first layer whose expected state is not demonstrated, then re-run the original controlled fixture after remediation.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- An event records that something happened.
- Include type, source, time and an ID.
- JSON is the usual format.
- Event schema (type, source, time, id, data) — structure
- CloudEvents format — standard
- Event catalogue — documentation
ReferenceWhy it matters1 section · depth on demand
In depth
In event-driven automation, an event is a record that something happened — an alert fired, a port went down, a pull request merged — delivered as a message with a type, source, time and payload. Rules match events and trigger actions.
| Event field | Example |
|---|---|
| Type | interface.down, alert.firing |
| Source | Device, monitoring system, Git host |
| Time | When it happened (not when received) |
| Payload | Interface name, severity, host |
| ID | For deduplication |
CloudEvents is a common standard envelope. Normalise events from different sources into one format before rules evaluate them, so one rule set handles them all.
ReferenceImportant terms & boundaries1 section · depth on demand
Mechanics
An event-driven automation event is a time-bound input to a decision pipeline: source plugin or transport receives data, the system normalizes it into an event payload, rules evaluate that payload (and possibly retained facts), and matching rules invoke actions. Delivery semantics matter. Event sources can retry or redeliver; queues can preserve or relax ordering; sources may emit duplicate observations; and multiple events can satisfy an any/all rule over a window. The event is therefore not the same thing as durable state. A useful event contract includes type/schema, producer, timestamp, stable subject/resource identity, correlation or deduplication identity and fields used by rules. Without those, two syntactically similar events can represent different occurrences or the same occurrence delivered twice. The rules engine's working memory and facts are another state layer that should be distinguished from the raw incoming event.
ReferenceConfiguration & state1 section · depth on demand
Lifecycle
Version event schemas and rulebooks together or provide explicit compatibility logic so producers can evolve without silently changing rule behavior. Normalize source-specific fields into stable internal attributes before policy-heavy matching, and define how long deduplication/correlation state is retained. Treat replay as a first-class lifecycle requirement: an operator should know whether replaying an event will safely reproduce observation, trigger a duplicate side effect, or be rejected by an idempotency key. Separate credentials for event ingestion from credentials used by actions. Monitor source health, queue backlog and rule execution independently because a healthy action runner cannot compensate for a disconnected event source. When retiring a field or event type, remove dependent rules only after proving producers and historical replays no longer require it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Event-Driven Automation > Events. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://docs.ansible.com/projects/rulebook/en/latest/sources.html · confidence 94%Quick lookup tables
Event-Driven Automation → Events · operational reference
Context-specific ownership, verification, output and failure-boundary lookup for Event-Driven Automation → Events.
| Layer | Event-Driven Automation → Events operational reference |
|---|---|
| Context identity | ansible-rulebook current + exact revision/input/target identity |
| Persistent intent | Versioned contract/configuration with explicit ownership and prerequisites |
| Verification | Validate inputs/read current state → exercise bounded operation → independent target read-back |
| Output contract | Preserve structured status/IDs/properties before human formatting |
| Failure boundary | Separate source/input/engine/controller execution from downstream target outcome |
Deep reference
Healthy vs suspicious evidence
Output interpretation
Event-driven output should preserve lineage. Capture source name, event type, subject/resource ID, correlation/deduplication key, ingest timestamp, selected rule, action execution ID and final action status. Avoid logging full payloads if they may contain secrets or personal data; retain a schema-valid safe subset or payload hash where appropriate. A rule-engine debug line that says a condition matched is intermediate evidence—it does not show whether the action succeeded or the target changed. Likewise, an action failure should not be reported as an event-source failure. For duplicate testing, show whether the duplicate was accepted, suppressed, merged or caused a second action. This structured chain makes replay and incident analysis possible without reconstructing causality from interleaved log text.