Get all the hosts programmatically from the flake
This commit is contained in:
parent
667f069a3b
commit
7b6e254ea3
|
@ -1,15 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
hosts=(
|
||||
"mail"
|
||||
"nextcloud"
|
||||
"plex"
|
||||
"management"
|
||||
"restic-server"
|
||||
"ttrss"
|
||||
"git"
|
||||
"proxy"
|
||||
"pihole"
|
||||
hosts=($(echo `nix eval .#nixosConfigurations --apply 'pkgs: builtins.concatStringsSep " " (builtins.attrNames pkgs)'` | xargs ))
|
||||
skip=(
|
||||
"gwyn"
|
||||
"loki-test"
|
||||
"desktop-vm"
|
||||
)
|
||||
|
||||
rsa_key="$HOME/.nixos/secrets/ssh_keys/ansible/ansible.key"
|
||||
|
@ -17,6 +12,10 @@ export NIX_SSHOPTS="-t -i $rsa_key"
|
|||
|
||||
for host in "${hosts[@]}"
|
||||
do
|
||||
# Check if the host is in the skip list
|
||||
if [[ " ${skip[*]} " =~ " ${host} " ]];then
|
||||
continue
|
||||
fi
|
||||
fqdn="$host.2li.local"
|
||||
echo $fqdn
|
||||
nixos-rebuild switch -j auto --use-remote-sudo --build-host localhost --target-host $fqdn --flake ".#$host"
|
||||
|
|
Loading…
Reference in New Issue