From 2b4a332bf65f87ec4b198134e935ab6f08a5bd18 Mon Sep 17 00:00:00 2001 From: catvayor Date: Fri, 31 Jan 2025 14:55:08 +0100 Subject: [PATCH] feat(netconf/scripts): init script for deployment --- meta/nodes/netconf.nix | 2 ++ scripts/netconf-apply.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100755 scripts/netconf-apply.sh diff --git a/meta/nodes/netconf.nix b/meta/nodes/netconf.nix index 162bd8d..278aee6 100644 --- a/meta/nodes/netconf.nix +++ b/meta/nodes/netconf.nix @@ -16,6 +16,8 @@ sshOptions = [ "-J" "root@vault01.hyp01.infra.dgnum.eu" + "-p" + "830" ]; }; diff --git a/scripts/netconf-apply.sh b/scripts/netconf-apply.sh new file mode 100755 index 0000000..c402a62 --- /dev/null +++ b/scripts/netconf-apply.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +# SPDX-FileCopyrightText: 2025 Lubin Bailly +# +# SPDX-License-Identifier: EUPL-1.2 + +set -Eeuo pipefail + +ssh_command=${SSH_COMMAND-ssh} + +target_host=$1 +shift + +if [ -z "$target_host" ] ; then + echo Usage: netconf-apply target-host + exit 1 +fi + +if toplevel="$(nix-build $(colmena eval -E "{ nodes, ... }: nodes.${target_host}.config.netconf.rpc" --instantiate))"; then + $ssh_command $(colmena eval -E "{nodes, ...}: + with nodes.${target_host}.config.deployment; + \"\${targetUser}@\${targetHost} \${builtins.concatStringsSep \" \" sshOptions}\"" | sed 's/"//g') \ + -s netconf < $toplevel +else + echo Build failed +fi