Class WorkflowRunner
java.lang.Object
com.scivicslab.actoriac.example.WorkflowRunner
Generic workflow runner for actor-IaC (Level 3).
This class provides a reusable entry point for executing workflows on infrastructure nodes. The actual operations are defined in external YAML/JSON/XML workflow files, not in Java code.
Usage
java -jar actor-IaC.jar inventory.ini webservers workflow.yaml
Actor Hierarchy
IIActorSystem
└─ NodeGroupIIAR (parent)
├─ NodeIIAR (child, autonomous agent)
├─ NodeIIAR (child, autonomous agent)
└─ NodeIIAR (child, autonomous agent)
Design Principle
This Java code is generic and does not need modification when changing targets or operations. All customization is done through:
- inventory.ini - Define hosts and groups
- workflow.yaml - Define operations to execute
- Author:
- devteam@scivics-lab.com
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Loggerprivate final NodeGroupIIARprivate final com.scivicslab.pojoactor.workflow.IIActorSystem -
Constructor Summary
ConstructorsConstructorDescriptionWorkflowRunner(com.scivicslab.pojoactor.workflow.IIActorSystem system, NodeGroupIIAR nodeGroupActor) Constructs a WorkflowRunner with the specified system and parent actor. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecuteCommand(String groupName, String command) Executes a single command on all nodes in the group.static voidMain entry point for workflow execution.voidExecutes the workflow on the specified group.
-
Field Details
-
LOG
-
system
-
nodeGroupActor
-
-
Constructor Details
-
WorkflowRunner
public WorkflowRunner(com.scivicslab.pojoactor.workflow.IIActorSystem system, NodeGroupIIAR nodeGroupActor) Constructs a WorkflowRunner with the specified system and parent actor.- Parameters:
system- the IIActorSystem for workflow executionnodeGroupActor- the NodeGroupIIAR parent actor
-
-
Method Details
-
main
Main entry point for workflow execution.Arguments:
- inventory - Path to Ansible inventory file
- group - Name of the host group to target
- workflow - Path to workflow file (YAML/JSON/XML)
- Parameters:
args- command line arguments- Throws:
Exception- if execution fails
-
run
Executes the workflow on the specified group.Uses the apply method with runWorkflow to load and run workflows on all matching child actors in a single step.
- Parameters:
groupName- the name of the host groupworkflowPath- the path to the workflow file- Throws:
Exception- if execution fails
-
executeCommand
Executes a single command on all nodes in the group.This is a convenience method for simple use cases where a full workflow is not needed.
- Parameters:
groupName- the name of the host groupcommand- the command to execute- Throws:
Exception- if execution fails
-