docs: update concepts/inventory to match new option structure

This commit is contained in:
Christian Friedow
2025-09-09 15:35:23 +02:00
parent 916186c465
commit 3630e778ad

View File

@@ -21,7 +21,7 @@ The following tutorial will walk through setting up a Backup service where the t
## Services ## Services
The inventory defines `services`. Membership of `machines` is defined via `roles` exclusively. The inventory defines `instances` of clan services. Membership of `machines` is defined via `roles` exclusively.
See each [modules documentation](../reference/clanServices/index.md) for its available roles. See each [modules documentation](../reference/clanServices/index.md) for its available roles.
@@ -31,9 +31,8 @@ A service can be added to one or multiple machines via `Roles`. Clan's `Role` in
Each service can still be customized and configured according to the modules options. Each service can still be customized and configured according to the modules options.
- Per instance configuration via `services.<serviceName>.<instanceName>.config` - Per role configuration via `inventory.instances.<instanceName>.roles.<roleName>.settings`
- Per role configuration via `services.<serviceName>.<instanceName>.roles.<roleName>.config` - Per machine configuration via `inventory.instances.<instanceName>.roles.<roleName>.machines.<machineName>.settings`
- Per machine configuration via `services.<serviceName>.<instanceName>.machines.<machineName>.config`
### Setting up the Backup Service ### Setting up the Backup Service
@@ -44,16 +43,17 @@ Each service can still be customized and configured according to the modules opt
See also: [Multiple Service Instances](#multiple-service-instances) See also: [Multiple Service Instances](#multiple-service-instances)
```{.nix hl_lines="6-7"} ```{.nix hl_lines="9-10"}
clan-core.lib.clan { {
inventory = { inventory.instances.instance_1 = {
services = { module = {
borgbackup.instance_1 = { name = "borgbackup";
# Machines can be added here. input = "clan-core";
roles.client.machines = [ "jon" ];
roles.server.machines = [ "backup_server" ];
};
}; };
# Machines can be added here.
roles.client.machines."jon" {};
roles.server.machines."backup_server" = {};
}; };
} }
``` ```
@@ -66,8 +66,8 @@ It is possible to add services to multiple machines via tags as shown
!!! Example "Tags Example" !!! Example "Tags Example"
```{.nix hl_lines="5 8 14"} ```{.nix hl_lines="5 8 18"}
clan-core.lib.clan { {
inventory = { inventory = {
machines = { machines = {
"jon" = { "jon" = {
@@ -76,13 +76,16 @@ It is possible to add services to multiple machines via tags as shown
"sara" = { "sara" = {
tags = [ "backup" ]; tags = [ "backup" ];
}; };
# ...
}; };
services = {
borgbackup.instance_1 = { instances.instance_1 = {
roles.client.tags = [ "backup" ]; module = {
roles.server.machines = [ "backup_server" ]; name = "borgbackup";
input = "clan-core";
}; };
roles.client.tags = [ "backup" ];
roles.server.machines."backup_server" = {};
}; };
}; };
} }
@@ -98,22 +101,34 @@ It is possible to add services to multiple machines via tags as shown
In this example `backup_server` has role `client` and `server` in different instances. In this example `backup_server` has role `client` and `server` in different instances.
```{.nix hl_lines="11 14"} ```{.nix hl_lines="17 26"}
clan-core.lib.clan { {
inventory = { inventory = {
machines = { machines = {
"jon" = {}; "jon" = {};
"backup_server" = {}; "backup_server" = {};
"backup_backup_server" = {} "backup_backup_server" = {};
}; };
services = {
borgbackup.instance_1 = { instances = {
roles.client.machines = [ "jon" ]; instance_1 = {
roles.server.machines = [ "backup_server" ]; module = {
name = "borgbackup";
input = "clan-core";
};
roles.client.machines."jon" = {};
roles.server.machines."backup_server" = {};
}; };
borgbackup.instance_2 = {
roles.client.machines = [ "backup_server" ]; instance_2 = {
roles.server.machines = [ "backup_backup_server" ]; module = {
name = "borgbackup";
input = "clan-core";
};
roles.client.machines."backup_server" = {};
roles.server.machines."backup_backup_server" = {};
}; };
}; };
}; };