nixos/scripts/remote_switch.sh

36 lines
577 B
Bash
Raw Normal View History

2022-01-31 12:42:56 +01:00
#!/usr/bin/env bash
2022-01-31 15:45:25 +01:00
hosts=(
2022-01-31 12:42:56 +01:00
"nixos-management"
2022-05-04 23:10:45 +02:00
#"grav"
2022-01-31 12:42:56 +01:00
"git"
2022-05-04 23:10:45 +02:00
#"heimdall"
2022-02-28 14:21:34 +01:00
"jdownloader"
2022-05-04 23:10:45 +02:00
#"k3s-master1"
#"k3s-node1"
#"k3s-node2"
2022-01-31 12:42:56 +01:00
"mail"
2022-01-31 15:45:25 +01:00
"nextcloud"
2022-05-04 23:10:45 +02:00
#"nomad-master1"
#"nomad-client1"
2022-01-31 15:45:25 +01:00
"pihole"
2022-01-31 12:42:56 +01:00
"plex"
2022-05-04 23:10:45 +02:00
#"proxy"
2022-02-28 15:15:11 +01:00
"restic-server"
2022-05-04 23:10:45 +02:00
#"rss-bridge"
#"test-server"
2022-01-31 12:42:56 +01:00
"ttrss"
)
2022-01-31 15:45:25 +01:00
rsa_key="$HOME/.nixos/secrets/ssh_keys/ansible/ansible.key"
export NIX_SSHOPTS="-t -i $rsa_key"
2022-01-31 12:42:56 +01:00
2022-01-31 15:45:25 +01:00
for host in "${hosts[@]}"
do
2022-01-31 12:42:56 +01:00
fqdn="$host.2li.local"
echo $fqdn
nixos-rebuild switch --use-remote-sudo --build-host localhost --target-host $fqdn --flake ".#$host"
echo
echo
done