Vagrant/Libvirt basic test/dev environment
Signed-off-by: Cédric Clerget <cedric.clerget@gmail.com>
This commit is contained in:
committed by
Jonathon Anderson
parent
f2869f4949
commit
0d041cbbbb
47
vagrant/alpine-boot.sh
Executable file
47
vagrant/alpine-boot.sh
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -d /tmp/alpine-rootfs ]; then
|
||||
rm -rf /tmp/alpine-rootfs
|
||||
fi
|
||||
|
||||
apptainer build -s /tmp/alpine-rootfs alpine-bootable.def
|
||||
|
||||
wwctl image import --force /tmp/alpine-rootfs alpine
|
||||
wwctl image build alpine
|
||||
|
||||
wwctl power off n1
|
||||
wwctl power off n2
|
||||
|
||||
if ! wwctl overlay list | grep "alpine-net" >/dev/null; then
|
||||
wwctl overlay create alpine-net
|
||||
wwctl overlay mkdir alpine-net /etc/network
|
||||
mkdir -p etc/network
|
||||
cat > etc/network/interfaces.ww <<EOF
|
||||
{{- range \$devname, \$netdev := .ThisNode.NetDevs }}
|
||||
# This file is autogenerated by warewulf
|
||||
{{- if \$netdev.OnBoot.BoolDefaultTrue }}
|
||||
auto {{ \$netdev.Device }}
|
||||
{{- end }}
|
||||
iface {{ \$netdev.Device }} inet static
|
||||
address {{ \$netdev.Ipaddr }}
|
||||
netmask {{ \$netdev.Netmask }}
|
||||
{{ if \$netdev.Gateway }}gateway {{ \$netdev.Gateway }}{{ end }}
|
||||
{{ if \$netdev.MTU }}mtu {{ \$netdev.MTU }}{{ end }}
|
||||
{{ end -}}
|
||||
EOF
|
||||
wwctl overlay import alpine-net etc/network/interfaces.ww
|
||||
fi
|
||||
|
||||
if ! wwctl profile list -j | jq -e 'to_entries[] | select(.key=="alpine")' >/dev/null; then
|
||||
wwctl profile add --profile=default alpine
|
||||
wwctl profile set -y alpine --system-overlays=$(wwctl profile list -j | jq -r 'to_entries[] | select(.key=="default") | .value."system overlay" | join(",")' | sed 's/debian.interfaces/alpine-net/')
|
||||
fi
|
||||
|
||||
wwctl node set -y --image=alpine --profile=alpine n1
|
||||
wwctl node set -y --image=alpine --profile=alpine n2
|
||||
wwctl overlay build n1
|
||||
wwctl overlay build n2
|
||||
|
||||
wwctl power on n1
|
||||
wwctl power on n2
|
||||
|
||||
Reference in New Issue
Block a user