Initial Commit

This commit is contained in:
Master Server 2020-02-08 01:01:31 +01:00
commit 5b670da462
8 changed files with 359 additions and 0 deletions

20
bin/tw_cli.nix Normal file
View File

@ -0,0 +1,20 @@
with import <nixpkgs> {};
stdenv.mkDerivation rec {
name = "tw_cli-${version}";
version = "2.00.11.022";
executable = /root/bin/tw_cli.x86_64;
phases = [ "installPhase" ];
installPhase = ''
install -m755 -D $executable $out/bin/tw_cli
'';
meta = with stdenv.lib; {
homepage = "";
description = "TW_CLI";
platforms = platforms.linux;
maintainers = with maintainers; [ fionera ];
};
}

BIN
bin/tw_cli.x86_64 Executable file

Binary file not shown.

9
cluster.nix Normal file
View File

@ -0,0 +1,9 @@
{
nodes = (import ./nodes.nix);
keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzB14Kgqtq38jwO5xGpYEzbFnPVNNM16G782rGsM2hPNGBxgCIaQ5wTyLl5GCCGR7yQESmSphTpnTnh+pcw0QqvBvbxHrLe691lvkdUhXBnz3Y22sFu294D99+X8gZgm/cS6yXkb/Bq5upzKrUCFpKoMkiPT560OduxiyN+922fyVCUNcVsYyd+6YCZGj1kdzK/dsax99L9aOeYsCCe5s1717xIIK+MakT7o8nqv/mVuMrWiuhE6fJ6lgv1TXNhhJhxxd8aXIQlr0jXHCS89Lt7qNW/FnyTY5OqHHTqd02O/l82XRnnI9ASZqUfGD27EhWovB6cjibNbooYpwIfCbz root@master"
"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvyZgx/+b0YU+CqDXLPbgOoRmpiyKYDkAsfXMpZ+aKVCtGZzmg8OeIVUDv1lbq+qQwNl+fOi7/V+U8w7BpyVUSf5Pn+ld/+eQK1IgkjsDyfdsFiXr4stzCDjpOzRTs/fludZ4WXEtBRJ0IsfX6VJWU2xXBZKrgw62XnbUv/I0hzpckf9Ug9RsCOdS70FfrmRxh2rCEpVdukS4KNyq8MHkwIQM381k26wvsAH6fhNJucICeBIDzfcP61bg4zWLiKQ+q+5c4U7cRoz/N0G2FNOWwQHooQueVC7+SY3Vh2o9AGG2H+Lbrg03e5NSSUBJa2ixZM933evno1yniv/NiTYbGw== lucas@luwo"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFNMlzpRFjkANy1tVafcLpkidbu1GF8cmmJK8dTwMZY4 fabian@fabian-T460s"
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDNCmn7zefioeRXtO5pfWuW/J0/cJwYu6KmrJ2rjvk/cWgasyHVur4QriKmQLIUjabXn4gFhsVTwe1vDsgeWgvVbWYxxkgUq0No1/x9D50uuV3oUF1RiysCmUOkZMwRcSgG1A9jw4LxhInw6LgIkgJEG4v1qCK8JOnNZ/T0gknpLHpUMrBEVNgij31lZXwA9CGGhCsM2ZxLmz7pZ2PsYGt+VroJZ8IVscr3BtjRgAIg/I7q0eiuY/MB2aPKw/2gunul3t0iLAHTK1CUvHbTmjpSU5M0ebQc4qbJIoKD0g1Ygq4kxXU1eB6IsQx2Sr+CRr4OH3mwOyVCfgrb7NErzMyb"
];
}

40
ipxe.nix Normal file
View File

@ -0,0 +1,40 @@
let
nixpkgs = <nixpkgs>;
pkgs = import nixpkgs {};
cluster = (import ./cluster.nix);
configuration = { config, pkgs, lib, ... }: with lib; {
imports = [
"${nixpkgs}/nixos/modules/installer/netboot/netboot-minimal.nix"
];
systemd.services.sshd.wantedBy = mkOverride 0 [ "multi-user.target" ];
networking.hostName = "";
users.users.root = {
openssh.authorizedKeys.keys = cluster.keys;
initialPassword = "root";
};
virtualisation.docker.enable = true;
i18n.consoleKeyMap = "de";
environment.systemPackages = with pkgs; [
(import ./bin/tw_cli.nix)
];
};
nixos = import "${nixpkgs}/nixos" {
inherit configuration;
# system = ...;
};
in
pkgs.symlinkJoin {
name = "netboot";
paths = with nixos.config.system.build; [
netbootRamdisk
kernel
netbootIpxeScript
];
preferLocalBuild = true;
}

14
nixops/nixops.nix Normal file
View File

@ -0,0 +1,14 @@
let
cluster = (import ./cluster.nix);
in {
nodes = map (x: {
{ config, pkgs, ... }:
{
deployment = {
targetHost = x.ip;
}
}) cluster.nodes;
}

12
nixops/trivial.nix Normal file
View File

@ -0,0 +1,12 @@
let
nodes = (import ../nodes.nix);
nameValuePair = name: value: { inherit name value; };
hosts = map (x: [
{ name = x.name; value = [ { name = "deployment.targetHost"; value = x.ip; } ]; }
]) nodes;
test = builtins.listToAttrs hosts;
in
test

245
nodes.nix Normal file
View File

@ -0,0 +1,245 @@
[
{
name = "node00";
mac = "00:30:48:bc:84:56";
ip = "10.10.0.100";
}
{
name = "node01";
mac = "00:30:48:bc:84:7a";
ip = "10.10.0.101";
}
{
name = "node02";
mac = "00:30:48:bc:85:5e";
ip = "10.10.0.102";
}
{
name = "node03";
mac = "00:30:48:bc:84:32";
ip = "10.10.0.103";
}
{
name = "node04";
mac = "00:30:48:bc:86:2e";
ip = "10.10.0.104";
}
{
name = "node05";
mac = "00:30:48:bc:84:0a";
ip = "10.10.0.105";
}
{
name = "node06";
mac = "00:30:48:bc:83:4e";
ip = "10.10.0.106";
}
{
name = "node07";
mac = "00:30:48:bc:34:24";
ip = "10.10.0.107";
}
{
name = "node08";
mac = "00:30:48:bc:85:d2";
ip = "10.10.0.108";
}
{
name = "node09";
mac = "00:30:48:bc:84:de";
ip = "10.10.0.109";
}
{
name = "node10";
mac = "00:30:48:bc:83:6a";
ip = "10.10.0.110";
}
{
name = "node11";
mac = "00:30:48:bc:83:82";
ip = "10.10.0.111";
}
{
name = "node12";
mac = "00:30:48:bc:86:1a";
ip = "10.10.0.112";
}
{
name = "node13";
mac = "00:30:48:bc:66:32";
ip = "10.10.0.113";
}
{
name = "node14";
mac = "00:30:48:bc:86:56";
ip = "10.10.0.114";
}
{
name = "node15";
mac = "00:30:48:bc:36:5c";
ip = "10.10.0.115";
}
{
name = "node16";
mac = "00:30:48:bc:85:e6";
ip = "10.10.0.116";
}
{
name = "node17";
mac = "00:30:48:bc:86:4e";
ip = "10.10.0.117";
}
{
name = "node18";
mac = "00:30:48:bc:85:aa";
ip = "10.10.0.118";
}
{
name = "node19";
mac = "00:30:48:bc:85:ce";
ip = "10.10.0.119";
}
{
name = "node20";
mac = "00:30:48:bc:36:8c";
ip = "10.10.0.120";
}
{
name = "node21";
mac = "00:30:48:bc:36:94";
ip = "10.10.0.121";
}
{
name = "node22";
mac = "00:30:48:bc:86:5a";
ip = "10.10.0.122";
}
{
name = "node23";
mac = "00:30:48:bc:86:36";
ip = "10.10.0.123";
}
{
name = "node24";
mac = "00:30:48:bc:83:9e";
ip = "10.10.0.124";
}
{
name = "node25";
mac = "00:30:48:bc:85:1e";
ip = "10.10.0.125";
}
{
name = "node26";
mac = "00:30:48:bc:86:16";
ip = "10.10.0.126";
}
{
name = "node27";
mac = "00:30:48:bc:34:94";
ip = "10.10.0.127";
}
{
name = "node28";
mac = "00:30:48:bc:86:62";
ip = "10.10.0.128";
}
{
name = "node29";
mac = "00:30:48:bc:86:46";
ip = "10.10.0.129";
}
{
name = "node30";
mac = "00:30:48:bc:85:da";
ip = "10.10.0.130";
}
{
name = "node31";
mac = "00:30:48:bc:85:de";
ip = "10.10.0.131";
}
{
name = "node32";
mac = "00:30:48:bc:85:72";
ip = "10.10.0.132";
}
{
name = "node33";
mac = "00:30:48:bc:84:4e";
ip = "10.10.0.133";
}
{
name = "node34";
mac = "00:30:48:bc:86:26";
ip = "10.10.0.134";
}
{
name = "node35";
mac = "00:30:48:bc:86:2a";
ip = "10.10.0.135";
}
{
name = "node36";
mac = "00:30:48:bc:34:80";
ip = "10.10.0.136";
}
{
name = "node37";
mac = "00:30:48:bc:33:9c";
ip = "10.10.0.137";
}
# hat zusaetzliche Karte mit 1 Nic
{
name = "node38";
mac = "00:30:48:bc:84:86";
ip = "10.10.0.138";
}
# hat zusaetzliche Karte mit 2 Nic
{
name = "node39";
mac = "00:30:48:bc:84:16";
ip = "10.10.0.139";
}
{
name = "node40";
mac = "00:30:48:bc:83:ce";
ip = "10.10.0.140";
}
{
name = "node41";
mac = "00:30:48:bc:83:d2";
ip = "10.10.0.141";
}
{
name = "node42";
mac = "00:30:48:bc:83:d6";
ip = "10.10.0.142";
}
{
name = "node43";
mac = "00:30:48:bc:84:be";
ip = "10.10.0.143";
}
{
name = "storage0";
mac = "00:30:48:ce:83:3a";
ip = "10.10.0.10";
}
{
name = "storage1";
mac = "";
ip = "10.10.0.11";
}
{
name = "storage2";
mac = "";
ip = "10.10.1.12";
}
{
name = "storage3";
mac = "";
ip = "10.10.1.13";
}
]

19
pixiecore.sh Normal file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash -e
nix-build --out-link /tmp/netboot ./ipxe.nix
n=$(realpath /tmp/netboot)
init=$(grep -ohP 'init=\S+' $n/netboot.ipxe)
# Start the PXE server.
# These ports need to be open in your firewall:
# UDP: 67, 69
# TCP: 64172
docker run --rm \
-v /etc/ssl/certs:/etc/ssl/certs:ro \
-v /nix/store:/nix/store:ro \
--net=host \
pixiecore/pixiecore:master \
boot $n/bzImage $n/initrd \
--cmdline "$init loglevel=4" \
-d --dhcp-no-bind --port 64172 --status-port 64172