infrastructure/modules/nixos/dgn-cephfs.nix
Ryan Lahfa 24360f4395
All checks were successful
Check meta / check_dns (pull_request) Successful in 18s
Check meta / check_meta (pull_request) Successful in 17s
Run pre-commit on all files / pre-commit (push) Successful in 38s
Check workflows / check_workflows (pull_request) Successful in 22s
Build all the nodes / ap01 (pull_request) Successful in 1m2s
Build all the nodes / geo01 (pull_request) Successful in 1m59s
Build all the nodes / bridge01 (pull_request) Successful in 2m4s
Build all the nodes / geo02 (pull_request) Successful in 2m1s
Build all the nodes / netcore02 (pull_request) Successful in 44s
Build all the nodes / compute01 (pull_request) Successful in 2m50s
Build all the nodes / rescue01 (pull_request) Successful in 3m11s
Build all the nodes / storage01 (pull_request) Successful in 3m12s
Build all the nodes / hypervisor02 (pull_request) Successful in 4m49s
Build all the nodes / hypervisor03 (pull_request) Successful in 4m48s
Build all the nodes / hypervisor01 (pull_request) Successful in 6m9s
Run pre-commit on all files / pre-commit (pull_request) Successful in 43s
Build all the nodes / vault01 (pull_request) Successful in 1m49s
Build all the nodes / web01 (pull_request) Successful in 2m9s
Build all the nodes / web02 (pull_request) Successful in 1m38s
Build all the nodes / web03 (pull_request) Successful in 1m44s
feat(machines/hypervisor0*): init
It contains a CephFS module which contains only monitor HA and the Incus enablement.

We are not using yet the Preseed to reproduce this on another set of
machines automatically.

Signed-off-by: Ryan Lahfa <ryan@dgnum.eu>
2024-12-21 00:18:56 +01:00

84 lines
1.8 KiB
Nix

# SPDX-FileCopyrightText: 2024 Ryan Lahfa <ryan@dgnum.eu>
# SPDX-FileContributor: Elias Coppens <elias@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{
meta,
pkgs,
config,
lib,
...
}:
let
inherit (lib)
mkEnableOption
mkIf
types
mkOption
concatStringsSep
;
cfg = config.dgn-cephfs;
in
{
options.dgn-cephfs = {
enable = mkEnableOption "the CephFS module for our hypervisors";
fsid = mkOption {
type = types.str;
};
initialMembers = mkOption {
type = types.attrsOf types.str;
default = { };
example = {
"hypervisor01" = "10.0.0.254";
"hypervisor02" = "10.0.0.253";
};
};
};
config = mkIf cfg.enable {
networking.firewall.allowedTCPPorts = [
6789
3300
];
networking.firewall.allowedTCPPortRanges = [
{
from = 6800;
to = 7300;
}
];
environment.systemPackages = [
pkgs.ceph
pkgs.gdb
];
environment.enableDebugInfo = true;
services.ceph = {
enable = true;
global = {
inherit (cfg) fsid;
monInitialMembers = concatStringsSep ", " (builtins.attrNames cfg.initialMembers);
monHost = concatStringsSep ", " (builtins.attrValues cfg.initialMembers);
# TODO: change it
clusterName = "ceph";
clusterNetwork = "10.0.254.0/24";
publicNetwork = "10.0.254.0/24";
};
extraConfig.public_addr = builtins.head meta.network.${config.networking.hostName}.addresses.ipv4;
osd = {
enable = true;
daemons = [ config.networking.hostName ];
};
mon = {
enable = true;
daemons = [ config.networking.hostName ];
};
mgr = {
enable = true;
daemons = [ config.networking.hostName ];
};
};
};
}