Add reboot option to update-single-machine command
This commit is contained in:
parent
b4ff563d77
commit
02b155960b
|
@ -5,6 +5,26 @@ cd /home/andreas/.nixos
|
||||||
rsa_key="~/.nixos/secrets/ssh_keys/ansible/ansible.key"
|
rsa_key="~/.nixos/secrets/ssh_keys/ansible/ansible.key"
|
||||||
export NIX_SSHOPTS="-t -i $rsa_key"
|
export NIX_SSHOPTS="-t -i $rsa_key"
|
||||||
|
|
||||||
host=$1
|
reboot=0
|
||||||
fqdn="$host.2li.local"
|
|
||||||
nixos-rebuild switch --use-remote-sudo --target-host $fqdn --flake ".#$host" |& nom
|
while getopts ":r" option; do
|
||||||
|
case $option in
|
||||||
|
r)
|
||||||
|
reboot=1
|
||||||
|
host=$2
|
||||||
|
fqdn="$host.2li.local"
|
||||||
|
echo "$fqdn with reboot"
|
||||||
|
nixos-rebuild boot -j auto --use-remote-sudo --target-host $fqdn --flake ".#$host" |& nom
|
||||||
|
ssh -i $rsa_key $fqdn 'sudo reboot'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $reboot -eq 0 ]; then
|
||||||
|
host=$1
|
||||||
|
fqdn="$host.2li.local"
|
||||||
|
echo "$fqdn"
|
||||||
|
nixos-rebuild switch -j auto --use-remote-sudo --target-host $fqdn --flake ".#$host" |& nom
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
|
Loading…
Reference in New Issue