Skip to content

Latest commit

 

History

History
59 lines (44 loc) · 2.37 KB

entities.adoc

File metadata and controls

59 lines (44 loc) · 2.37 KB

Entities

An entity is something that exists - a "thing", like a VM, or a Container is an entity. OliveTin allows you to then dynamically generate actions based around these entities.

This is really useful if you want to generate wake on lan or poweroff actions for server entities, for example.

A very popular use case that entities were designed for was for container entities - in a similar way you could generate start, stop, and restart container actions.

Entities are just loaded fome files on disk, OliveTin will also watch these files for updates while OliveTin is running, and update entities.

Entities can have properties defined in those files, and those can be used in your configuration as variables. For example; container.status, or vm.hostname.

entities:
  - file: /etc/OliveTin/containers.json
    name: container

  - file: /etc/OliveTin/servers.yaml
    name: server

Entity Actions can only be used on Dashboards.

YAML entity files

YAML files are the default expected format, so you can use .yml, .yaml, or even .txt - as long as the file contains a valid yaml LIST, then it will be loaded.

/etc/OliveTin/servers.yaml
server1:
  state: started
  hostname: server1.example.com
  ip: 192.168.0.1
server2:
  state: started
  hostname: server2.example.com
  ip: 192.168.0.2
server3:
  state: stopped
  hostname: server3.example.com
  ip: 192.168.0.3

JSON entity files

JSON files are parsed as if each line is a single JSON object. This can be super helpful for getting a list of containers, for example; docker ps -a --format=json > /etc/OliveTin/containers.json.

/etc/OliveTin/containers.json
{"Command":"\"/opt/entrypoint.sh\"","CreatedAt":"2024-02-08 15:27:42 +0000 GMT","ID":"4bafe6f9f956","Image":"fedora","Labels":"?","LocalVolumes":"0","Mounts":"","Names":"media-indexing-container","Networks":"bridge","Ports":"","RunningFor":"13 days ago","Size":"0B","State":"exited","Status":"Exited (128) 13 days ago"}
{"Command":"\"/opt/entrypoint.sh\"","CreatedAt":"2023-12-17 20:58:03 +0000 GMT","ID":"d25f37c49c35","Image":"fedora","Labels":"?","LocalVolumes":"0","Mounts":"","Names":"media-playback-container","Networks":"bridge","Ports":"","RunningFor":"27 days ago","Size":"0B","State":"exited","Status":"Exited (137) 27 days ago"}