-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.justfile
69 lines (55 loc) · 1.5 KB
/
.justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
os_vm_args := if os() == "macos" { "--vm-type=vz --rosetta" } else { "" }
default:
just -l
lsvm:
@limactl ls --format '{{{{.Name}} | {{{{.Status}}'
hostvm id:
@cat $(limactl info | jq -r .limaHome)/{{id}}/ssh.config \
| grep -E "Hostname|Port" \
| sed 's/^ *//' \
| cut -f 2 -d ' ' \
| paste -sd: -
hostswarm name:
@for id in $(limactl list --format '{{{{.Name}}' | grep {{name}}); do \
just hostvm $id; \
done
sshconfig name:
@echo "hosts = $(just hostlist {{name}})" > sshpools.toml
@echo "key_file = \"${HOME}/.lima/_config/user\"" >> sshpools.toml
@echo "username = \"${USER}\"" >> sshpools.toml
@cat sshpools.toml
hostlist name:
@just hostswarm {{name}} \
| sed 's/.*/"&"/' \
| paste -sd, - \
| sed 's/.*/\[&\]/'
mkvm id:
limactl create \
--name="{{id}}" \
--mount-type=virtiofs \
--mount-writable \
{{os_vm_args}} \
--cpus=1 \
--memory=1 \
--tty=false \
template://default
mkswarm name count:
for i in $(seq 1 {{count}}); do \
just mkvm {{name}}-$i; \
done
startswarm name:
for id in $(limactl list --format '{{{{.Name}}' | grep {{name}}); do \
limactl start $id; \
done
stopswarm name:
for id in $(limactl list --format '{{{{.Name}}' | grep {{name}}); do \
limactl stop $id; \
done
rmvm id:
limactl delete {{id}}
rmswarm name:
for id in $(limactl list --format '{{{{.Name}}' | grep {{name}}); do \
just rmvm $id; \
done
shellvm id:
eval $(limactl show-ssh --format=cmd "{{id}}" 2>/dev/null)