try a script to install a new vm

This commit is contained in:
Andreas Zweili 2022-01-25 17:50:58 +01:00
parent 1fd86a5022
commit 70693704e8
1 changed files with 16 additions and 0 deletions

16
scripts/install_new_vm.xsh Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env xonsh
host = "nixos"
download_command = "curl https://git.2li.ch/Nebucatnetzer/nixos/archive/master.tar.gz | tar xz"
nixshell_command = "cd nixos && nix-shell"
format_command = "sudo python3 scripts/format-disk.py"
install_command = "sudo nixos-install --no-root-passwd --root /mnt --impure --flake .#" + host
for host in hosts:
fqdn = "{}.2li.local".format(host)
ssh-copy-id @(fqdn)
ssh -t @(fqdn) @(download_command)
ssh -t @(fqdn) @(nixshell_command)
ssh -t @(fqdn) @(format_command)
ssh -t @(fqdn) @(install_command)