inventory: allow per role configuration

This commit is contained in:
Jörg Thalheim
2024-07-15 13:43:43 +02:00
parent 0aac83b8c5
commit 7e3881d618
2 changed files with 7 additions and 0 deletions

View File

@@ -83,6 +83,11 @@ let
else else
throw "Module doesn't have role: '${role}'. Path: ${path} not found." throw "Module doesn't have role: '${role}'. Path: ${path} not found."
) inverseRoles.${machineName} or [ ]; ) inverseRoles.${machineName} or [ ];
roleServiceConfigs = builtins.map (
role:
serviceConfig.roles.${role}.config or { }
) inverseRoles.${machineName} or [ ];
in in
if isInService then if isInService then
acc2 acc2
@@ -92,6 +97,7 @@ let
config.clan.${moduleName} = lib.mkMerge [ config.clan.${moduleName} = lib.mkMerge [
globalConfig globalConfig
machineServiceConfig machineServiceConfig
roleServiceConfigs
]; ];
} }
{ {

View File

@@ -94,6 +94,7 @@ in
apply = lib.unique; apply = lib.unique;
type = t.listOf tagRef; type = t.listOf tagRef;
}; };
options.config = moduleConfig;
} }
); );
}; };