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
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
hosts=(
|
hosts=($(echo `nix eval .#nixosConfigurations --apply 'pkgs: builtins.concatStringsSep " " (builtins.attrNames pkgs)'` | xargs ))
|
||||||
"mail"
|
skip=(
|
||||||
"nextcloud"
|
"gwyn"
|
||||||
"plex"
|
"loki-test"
|
||||||
"management"
|
"desktop-vm"
|
||||||
"restic-server"
|
|
||||||
"ttrss"
|
|
||||||
"git"
|
|
||||||
"proxy"
|
|
||||||
"pihole"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
rsa_key="$HOME/.nixos/secrets/ssh_keys/ansible/ansible.key"
|
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[@]}"
|
for host in "${hosts[@]}"
|
||||||
do
|
do
|
||||||
|
# Check if the host is in the skip list
|
||||||
|
if [[ " ${skip[*]} " =~ " ${host} " ]];then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
fqdn="$host.2li.local"
|
fqdn="$host.2li.local"
|
||||||
echo $fqdn
|
echo $fqdn
|
||||||
nixos-rebuild switch -j auto --use-remote-sudo --build-host localhost --target-host $fqdn --flake ".#$host"
|
nixos-rebuild switch -j auto --use-remote-sudo --build-host localhost --target-host $fqdn --flake ".#$host"
|
||||||
|
|
Loading…
Reference in New Issue