feat(netconf/scripts): init script for deployment

This commit is contained in:
catvayor 2025-01-31 14:55:08 +01:00 committed by mdebray
parent fabfc982f2
commit 2b4a332bf6
2 changed files with 28 additions and 0 deletions

View file

@ -16,6 +16,8 @@
sshOptions = [
"-J"
"root@vault01.hyp01.infra.dgnum.eu"
"-p"
"830"
];
};

26
scripts/netconf-apply.sh Executable file
View file

@ -0,0 +1,26 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2025 Lubin Bailly <lubin.bailly@dgnum.eu>
#
# 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