Define rules that trigger automation from events
A rulebook is a set of conditional rules that Event-Driven Ansible uses to perform IT actions in an event-driven automation model. Rulebooks are the means that users tell Event-Driven Ansible which source to check for an event and when that event occurs what to do when certain conditions are met.
A rulebook specifies actions to be performed when a rule is triggered. A rule gets triggered when the events match the conditions for the rules. The following actions are currently supported:
run_playbook(only supported with ansible-rulebook CLI)-
run_module -
run_job_template -
run_workflow_template -
set_fact -
post_event -
retract_fact -
print_event -
shutdown -
debug -
none
To view further details, see Ansible Actions.
A rulebook activation is a process running in the background defined by a decision environment executing a specific rulebook. You can set up your rulebook activation by following Set up a rulebook activation.
Red Hat does not recommend the use of a non-supported source plugin with 1 postgres database. This can pose a potential risk to your use of Ansible Automation Platform.
dispatcherd service. When the workers are unavailable, you will not be able to create or sync projects, or enable rulebook activations.
Set up a rulebook activation
Create a rulebook activation to link a rulebook to a decision environment and event sources, initiating the event-driven automation process.
Before you begin
- You are logged in to the Ansible Automation Platform Dashboard as a Content Consumer.
- You have set up a project.
- You have set up a decision environment.
Procedure
Results
Your rulebook activation is now created and can be managed on the Rulebook Activations page.
After saving the new rulebook activation, the rulebook activation’s details page is displayed, with either a Pending, Running, or Failed status. From there or the Rulebook Activations list view, you can restart or delete it.
Occasionally, when a source plugin shuts down, it causes a rulebook to exit gracefully after a certain amount of time. When a rulebook activation shuts down, any tasks that are waiting to be performed will be canceled, and an info level message is sent to the activation log. For more information, see Content from docs.ansible.com is not included.Rulebooks.
What to do next
Rulebook activation list view
Use the Rulebook Activations list view to quickly monitor the operational status, event fire count, and restart frequency of all your deployed automation services.
If the Status is Running, it means that the rulebook activation is running in the background and executing the required actions according to the rules declared in the rulebook.
You can view more details by selecting the activation from the Rulebook Activations list view.
For all activations that have run, you can view the Details and History tabs to get more information about what happened.
View activation output
View the activation output in the History tab to inspect the execution results, confirm successful automation runs, and diagnose runtime errors or task failures.
Procedure
- Select the History tab to access the list of all the activation instances. An activation instance represents a single execution of the activation.
- Then select the activation instance you want to view. The Output for the activation instance is displayed.
What to do next
To view events that came in and triggered an action, navigate to and follow instructions in the Rule Audit section.
Auto-restart on project update for rulebook activations
When a project synchronizes and the rulebook content has changed in the source repository, you can configure the system to automatically restart the affected rulebook activation. This ensures that running activations always use the most current rulebook logic without manual intervention.
Without auto-restart, a project synchronization updates the rulebook files on disk but any currently running activations continue to use the previously loaded rulebook logic. This can lead to a mismatch between the rulebook definitions in your source repository and the logic that is actively processing events. Auto-restart eliminates this drift by ensuring that activations are automatically restarted with the updated rulebook content after a project sync.
The behavior of an auto-restart is determined by the combined state of the Update revision on launch setting in the project and the Auto-restart on project update setting in the activation. Because these features are interdependent, changing a project setting may trigger confirmation prompts to ensure you understand the impact on all associated rulebook activations. For more information on the interdependencies, see Project and rulebook activation settings interdependencies.