diff options
author | makefu <github@syntax-fehler.de> | 2016-10-29 14:48:19 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2016-10-29 14:48:19 +0200 |
commit | 95987322a19800f95658bc57092fab91a5a8d610 (patch) | |
tree | f42c10ac80036fa3b253703a08df474d8ab999be | |
parent | 6b97aab241fa916178c32849fb00d12d08cec5d0 (diff) |
-rw-r--r-- | init-stockholm/host.py | 35 | ||||
-rw-r--r-- | shell.nix | 1 |
2 files changed, 23 insertions, 13 deletions
diff --git a/init-stockholm/host.py b/init-stockholm/host.py index 8939ced..99646c1 100644 --- a/init-stockholm/host.py +++ b/init-stockholm/host.py @@ -37,9 +37,9 @@ def retiolum_ip(hostname): ret = {"hostname": hostname} ret["v6"] = str(ip.IPv6Address(mynet6[0] + - randint(0,mynet6.num_addresses)))+"/128" + randint(0,mynet6.num_addresses))) ret["v4"] = str(ip.IPv4Address(mynet4[0] + - randint(0,mynet4.num_addresses)))+"/32" + randint(0,mynet4.num_addresses))) return ret def write_stockholm_1systems(ret,stockholm_dir): @@ -55,9 +55,17 @@ def write_stockholm_1systems(ret,stockholm_dir): with open(p,"w+") as f: f.write("""{{ config, pkgs, ... }}: {{ + imports = [ + ../. + # configure your hw: + # ../2configs/hw/CAC.nix + # ../2configs/fs/CAC-CentOS-7-64bit.nix + # ../2configs/save-diskspace.nix + + ]; krebs = {{ enable = true; - retiolum.enable = true; + tinc.retiolum.enable = true; build.host = config.krebs.hosts.{hostname}; }}; # You want to change these :) @@ -72,7 +80,7 @@ def write_stockholm_1systems(ret,stockholm_dir): def print_stockholm_krebs_entry(ret): if "ssh" in ret: ret['ssh_entry'] = """ -ssh.privkey.path = <{key_file}>; +ssh.privkey.path = <secrets/{key_file}>; ssh.pubkey = "{pubkey}";""".format(**ret['ssh']) else: ret['ssh_entry'] = "" @@ -82,13 +90,13 @@ ssh.pubkey = "{pubkey}";""".format(**ret['ssh']) cores = 1; {ssh_entry} nets = {{ - retiolm = {{ - addrs4 = ["{v4}"]; - addrs6 = ["{v6}"]; - aliases = [ - "{hostname}.retiolum" - ]; - tinc.pubkey = '' + retiolum = {{ + ip4.addr = "{v4}"; + ip6.addr = "{v6}"; + aliases = [ + "{hostname}.retiolum" + ]; + tinc.pubkey = '' {pubkey}''; }}; }}; @@ -130,10 +138,11 @@ def generate_ssh_keys(secrets_dir,hostname,typ="ed25519"): "-f",key_file, "-N",""]).communicate() with open(pub_file) as f: - pubkey = f.read() + pubkey = f.read().strip() os.unlink(pub_file) mark(key_file) - return { "pubkey": pubkey, "key_file": key_file } + from os.path import basename + return { "pubkey": pubkey, "abs_keyfile": key_file , "key_file": basename( key_file ) } def prepare_secrets(sec): if not exists(sec): @@ -6,5 +6,6 @@ pkgs.stdenv.mkDerivation rec { buildInputs = with pkgs; [ pkgs.python35Packages.python pkgs.python35Packages.docopt + pkgs.tinc_pre ]; } |