deploy: function for listing hosts
This commit is contained in:
parent
3fbcf03c7c
commit
751c167fa4
@ -8,6 +8,14 @@ msg() {
|
||||
echo -e "===> $@"
|
||||
}
|
||||
|
||||
listNixOSHosts() {
|
||||
for i in $(nix eval .#nixosConfigurations --apply builtins.attrNames --json | jq -r '.[]'); do
|
||||
if [ -d hosts/${i} ]; then
|
||||
echo $i
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
resolveAlias() {
|
||||
host="${1}"
|
||||
if [ -f hosts/${host}/alias ]; then
|
||||
|
4
deploy
4
deploy
@ -34,7 +34,7 @@ rebuild() {
|
||||
if [ "$1" = "status" ]; then
|
||||
rev=$(git rev-parse HEAD)
|
||||
msg "Currently at: ${rev}\t($(git log --format=%B -n 1 $rev | head -n1))"
|
||||
for h in $(nix eval .#nixosConfigurations --apply builtins.attrNames --json | jq -r '.[]'); do
|
||||
for h in $(listNixOSHosts); do
|
||||
host="$(resolveAlias $h)"
|
||||
if ! tsAlive $host; then
|
||||
msg "can't reach ${host}.. skipping.."
|
||||
@ -126,7 +126,7 @@ ret=0
|
||||
if [ ${#@} = 1 ]; then
|
||||
rebuild $1 true || ret=1
|
||||
else
|
||||
for host in $(nix eval .#nixosConfigurations --apply builtins.attrNames --json | jq -r '.[]'); do
|
||||
for host in $(listNixOSHosts); do
|
||||
rebuild $host false || ret=1
|
||||
done
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user