mirror of
https://github.com/sstent/nixos-cluster.git
synced 2025-12-05 21:51:51 +00:00
sync
This commit is contained in:
@@ -9,10 +9,12 @@
|
||||
./hardware-configuration.nix
|
||||
../../modules/odroid-m1-setleds.nix
|
||||
../../modules/odroid-m1.nix
|
||||
../../modules/keepalived.nix
|
||||
];
|
||||
|
||||
nixpkgs.hostPlatform.system = "aarch64-linux";
|
||||
networking.hostName = "odroid6";
|
||||
custom.VIP_Priority = 100;
|
||||
networking.interfaces.end0.ipv4.addresses = [
|
||||
{
|
||||
address = "192.168.4.226";
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
./hardware-configuration.nix
|
||||
../../modules/odroid-m1-setleds.nix
|
||||
../../modules/odroid-m1.nix
|
||||
../../modules/keepalived.nix
|
||||
];
|
||||
|
||||
nixpkgs.hostPlatform.system = "aarch64-linux";
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
../../modules/odroid-m1-setleds.nix
|
||||
../../modules/odroid-m1.nix
|
||||
../../modules/cifs.nix
|
||||
../../modules/keepalived.nix
|
||||
];
|
||||
|
||||
nixpkgs.hostPlatform.system = "aarch64-linux";
|
||||
|
||||
@@ -7,11 +7,13 @@
|
||||
}: {
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
# ../../modules/keepalived.nix
|
||||
];
|
||||
|
||||
nixpkgs.hostPlatform.system = "x86_64-linux";
|
||||
networking.hostName = "opti1";
|
||||
|
||||
# custom._Networkinterface = "enp0s31f6";
|
||||
# custom.VIP_Priority = 100;
|
||||
networking.interfaces.end0.ipv4.addresses = [
|
||||
{
|
||||
address = "192.168.4.36";
|
||||
@@ -19,6 +21,8 @@
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
|
||||
networking.defaultGateway = "192.168.4.1";
|
||||
networking.nameservers = ["192.168.4.1" "8.8.8.8"];
|
||||
# Bootloader.
|
||||
|
||||
@@ -12,7 +12,11 @@
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
boot.kernelParams = [ "net.ifnames=0" "biosdevname=1" ];
|
||||
systemd.network.links."10-custom-ethernet" = {
|
||||
matchConfig.MACAddress = "d8:9e:f3:83:df:d6";
|
||||
linkConfig.Name = "end0";
|
||||
};
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/7245da7d-e72b-403a-8b72-e99cdd8c02fa";
|
||||
fsType = "ext4";
|
||||
@@ -27,7 +31,7 @@
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.wlp0s20f0u3.useDHCP = lib.mkDefault true;
|
||||
|
||||
# networking.usePredictableInterfaceNames = true;
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
2
justfile
2
justfile
@@ -8,7 +8,7 @@ deploy-dry NODE:
|
||||
nixos-rebuild --flake .#{{NODE}} --fast --target-host root@{{NODE}}.node.dc1.consul --build-host root@{{NODE}}.node.dc1.consul dry-activate
|
||||
|
||||
deploy-all:
|
||||
just deploy odroid5
|
||||
just deploy opti1
|
||||
just deploy odroid6
|
||||
just deploy odroid7
|
||||
just deploy odroid8
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
# ./mnt-clusterstore.nix
|
||||
./nomad.nix
|
||||
./consul.nix
|
||||
./cifs.nix
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
];
|
||||
|
||||
@@ -21,6 +20,20 @@
|
||||
description = "Path to the Secrets storage";
|
||||
};
|
||||
|
||||
options.custom._Networkinterface = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "end0";
|
||||
description = "Network interface name to bind to.";
|
||||
example = "enp3s0";
|
||||
};
|
||||
|
||||
options.custom.VIP_Priority = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 50;
|
||||
description = "Keep alived prority for voting";
|
||||
};
|
||||
|
||||
|
||||
config = {
|
||||
system.stateVersion = "23.11"; # Did you read the comment?
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
...
|
||||
}: let
|
||||
secretstore = config._secretstore;
|
||||
NetworkInterface = config.custom._Networkinterface;
|
||||
|
||||
# oldpkgs = import (builtins.fetchGit {
|
||||
# # Descriptive name to make the store path easier to identify
|
||||
# name = "git_consul_1_9";
|
||||
@@ -25,6 +27,9 @@ in {
|
||||
format = "binary";
|
||||
owner = "consul";
|
||||
group = "consul";
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
networking.firewall = {
|
||||
@@ -37,7 +42,7 @@ in {
|
||||
enable = true;
|
||||
webUi = true;
|
||||
# consulAddr = "0.0.0.0:8500";
|
||||
interface.bind = "end0";
|
||||
interface.bind = "${NetworkInterface}";
|
||||
extraConfigFiles = [config.sops.secrets."consul_encrypt.json".path];
|
||||
extraConfig = {
|
||||
bootstrap = false;
|
||||
@@ -54,18 +59,19 @@ in {
|
||||
raft_multiplier = 7;
|
||||
};
|
||||
recursors = [
|
||||
"192.168.1.1"
|
||||
"192.168.4.1"
|
||||
"8.8.8.8"
|
||||
];
|
||||
|
||||
retry_join = [
|
||||
"192.168.1.221"
|
||||
"192.168.1.222"
|
||||
"192.168.1.225"
|
||||
"192.168.1.226"
|
||||
"192.168.1.227"
|
||||
"192.168.1.223"
|
||||
"192.168.1.224"
|
||||
"192.168.4.221"
|
||||
"192.168.4.222"
|
||||
"192.168.4.225"
|
||||
"192.168.4.226"
|
||||
"192.168.4.227"
|
||||
"192.168.4.223"
|
||||
"192.168.4.224"
|
||||
"192.168.4.36"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
22
modules/keepalived.nix
Normal file
22
modules/keepalived.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
with lib; let
|
||||
NetworkInterface = config.custom._Networkinterface;
|
||||
VIP_Priority = config.custom.VIP_Priority;
|
||||
in {
|
||||
|
||||
|
||||
services.keepalived = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
vrrpInstances.VIP_250 = {
|
||||
interface = "${NetworkInterface}";
|
||||
virtualRouterId = 51;
|
||||
priority = VIP_Priority;
|
||||
unicastPeers = ["192.168.4.226" "192.168.4.227" "192.168.4.228" "192.168.4.36"];
|
||||
virtualIps = [{addr = "192.168.4.250/22";}];
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 80 443 ]; # optional
|
||||
}
|
||||
Reference in New Issue
Block a user