Inventory: add concrete use-case examples

This commit is contained in:
Johannes Kirschbauer 2024-06-19 13:03:15 +02:00
parent 6c11e0ced7
commit afdfa6181b
Signed by: hsjobeki
SSH Key Fingerprint: SHA256:vX3utDqig7Ph5L0JPv87ZTPb/w7cMzREKVZzzLFg9qU
6 changed files with 130 additions and 79 deletions

View File

@ -1,20 +1,8 @@
package machines
#ServiceRole: "server" | "client" | "both"
#machine: machines: [string]: {
name: string,
description?: string,
icon?: string,
// each machines service
services?: [string]: {
// Roles if specificed must contain one or more roles
// If no roles are specified, the service module defines the default roles.
roles?: [ ...#ServiceRole ],
// The service config to use
// This config is scoped to the service.module, only serializable data (strings,numbers, etc) can be assigned here
config: {
...
}
}
icon?: string
}

View File

@ -1,5 +1,7 @@
package services
#ServiceRole: "server" | "client" | "both"
#service: services: [string]: {
// Required meta fields
meta: {
@ -12,14 +14,14 @@ package services
// We moved the machine sepcific config to "machines".
// It may be moved back depending on what makes more sense in the future.
// machineConfig: {
// [string]: {
// roles: string[],
// config: {
// defaultUser?: string
// }
// }
// },
machineConfig: {
[string]: {
roles?: [ ...#ServiceRole ],
config?: {
...
}
}
},
// Configuration for the service
config: {

View File

@ -1,58 +0,0 @@
{
"machines": {
"jon_machine": {
"name": "jon",
"description": "Jon's machine",
"icon": "assets/icon.png",
"services": {
"matrix": {
"roles": ["server"]
}
}
},
"anna_machine": {
"name": "anna",
"description": "anna's machine"
}
},
"meta": {
"name": "clan name"
},
"services": {
"sync-home": {
"meta": {
"name": "My Home Sync"
},
"module": "syncthing",
"config": {
"folders": ["/sync/my_f"]
}
},
"matrix": {
"meta": {
"name": "Our matrix chat",
"description": "Matrix chat service for our clan"
},
"module": "matrix-synapse",
"config": {
"compression": "zstd"
}
},
"backup": {
"meta": {
"name": "My daily backup"
},
"module": "borgbackup",
"config": {}
},
"borgbackup_1": {
"meta": {
"name": "My weekly backup"
},
"module": "borgbackup",
"config": {
"compression": "lz4"
}
}
}
}

View File

@ -0,0 +1,38 @@
{
"machines": {
"camina_machine": {
"name": "camina"
},
"vyr_machine": {
"name": "vyr"
},
"vi_machine": {
"name": "vi"
}
},
"meta": {
"name": "kenjis clan"
},
"services": {
"backup": {
"meta": {
"name": "My backup"
},
"module": "borbackup-static",
"machineConfig": {
"vyr": {
"roles": ["server"]
},
"vi": {
"roles": ["client"]
},
"camina_machine": {
"roles": ["client"]
}
},
"config": {
"folders": ["/home", "/root", "/var", "/etc"]
}
}
}
}

View File

@ -0,0 +1,45 @@
{
"machines": {
"camina_machine": {
"name": "camina"
},
"vyr": {
"name": "vyr"
},
"vi": {
"name": "vi"
}
},
"meta": {
"name": "kenjis clan"
},
"services": {
"sync_files": {
"meta": {
"name": "My sync"
},
"module": "syncthing-static-peers",
"machineConfig": {
"vyr": {},
"vi": {},
"camina_machine": {}
},
"config": {
"folders": {
"test": {
"path": "~/data/docs",
"devices": ["camina", "vyr", "vi"]
},
"videos": {
"path": "~/data/videos",
"devices": ["camina", "vyr", "ezra"]
},
"playlist": {
"path": "~/data/playlist",
"devices": ["camina", "vyr", "ezra"]
}
}
}
}
}
}

View File

@ -0,0 +1,36 @@
{
"machines": {
"camina_machine": {
"name": "camina"
},
"vyr_machine": {
"name": "vyr"
},
"vi_machine": {
"name": "vi"
}
},
"meta": {
"name": "kenjis clan"
},
"services": {
"backup": {
"meta": {
"name": "My backup"
},
"module": "borbackup-static",
"machineConfig": {
"vyr_machine": {
"roles": ["server"]
},
"vi_machine": {
"roles": ["peer"]
},
"camina_machine": {
"roles": ["peer"]
}
},
"config": {}
}
}
}