From f78acaa4abbdcf1bad3c72576ad38ea9bb98ce2f Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Tue, 7 Feb 2023 03:13:55 +0100 Subject: readme --- README.md | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/README.md b/README.md index 548d523..4058db8 100644 --- a/README.md +++ b/README.md @@ -1 +1,89 @@ # automato + +## Paradigm +___ + +#### Endpoint + +Object to group *States*, *Commands* and *Transports*. +Endpoints can be seen as a *Transport Domain*, commands and states can only use the ones of their endpoint. +In most cases this would be a logical host, like a Raspberry, PC or VM. + +#### State + +A (numeric) value, or set of values, describing the current state of an *endpoint*. +They are collected on demand and cached for a specific time set by the `ttl` parameter. +A State is addressed via `.`, +some states allow passing of keys to select from multiple values by a dot followed by the key: `..` + + +#### Command + +A way of manipulating an *endpoint*. +A State is addressed via `.` and can accept additional arguments upon invocation. + + +#### Transport + +Communication channel to the *endpoint* used by *commands* and *states*. +A transport can only be used by *commands* and *states* of its *endpoint* and thus is just referenced by its name. + +#### Trigger + +regularily checked conditions used to trigger *actions*. +Triggers are re-evaluated in an interval set by the `interval` parameter. +*Actions* hold instances of triggers, which can have their own settings, +but still inherit the globally set ones. + + +#### Action + +An *If-This-Then-That* style set of *triggers* and *commands*. +If all *triggers* are in a triggered state, the commands are executed. + + +## Configuration +___ + +automato is configured in three `yml`-files + +`endpoints.yml` +```yaml +host1: + transports: + ssh: + class: automato.transport.SshTransport + hostname: 'localhost' + username: 'jonas' + commands: + notify: + class: automato.command.NotifyCommand + transport: ssh + states: + user: + class: automato.state.UserSessionState + transport: ssh + ttl: 30 +``` + +`triggers.yml` +```yaml +conditional: + class: automato.trigger.ConditionalTrigger +``` + +`actions.yml` +```yaml +send-hello: + trigger: + - conditional: + interval: 30 + when: + - host1.user.jonas > 0 + - True + then: + - host1.notify: + msg: Hello + - host1.notify: + msg: World! +``` -- cgit v1.2.3