20 lines
1.1 KiB
Bash
20 lines
1.1 KiB
Bash
#!/bin/sh
|
|
# Run on pxe-server as root from the directory containing these files.
|
|
# Expects /etc/pve-vbmc/config.json to exist already (see config.example.json).
|
|
set -eu
|
|
cd "$(dirname "$0")"
|
|
getent passwd pve-vbmc >/dev/null || useradd --system --no-create-home --shell /usr/sbin/nologin --user-group pve-vbmc
|
|
install -m 0755 pve_vbmc.py /usr/local/bin/pve_vbmc.py
|
|
install -m 0755 pve-vbmc-addrs.sh /usr/local/bin/pve-vbmc-addrs.sh
|
|
install -m 0644 pve-vbmc@.service pve-vbmc-addrs.service /etc/systemd/system/
|
|
chgrp pve-vbmc /etc/pve-vbmc/config.json && chmod 0640 /etc/pve-vbmc/config.json
|
|
systemctl daemon-reload
|
|
systemctl enable --now pve-vbmc-addrs.service
|
|
# NOTE: on netplan/systemd-networkd hosts a later reconfigure flushes addresses added by the
|
|
# service (seen in the lab: the BMCs stopped answering). Also list the BMC addresses under the
|
|
# pxenet interface in /etc/netplan/*.yaml so they survive.
|
|
for v in $(python3 -c 'import json;print(" ".join(str(b["vmid"]) for b in json.load(open("/etc/pve-vbmc/config.json"))["bmcs"]))'); do
|
|
systemctl enable --now "pve-vbmc@$v.service"
|
|
done
|
|
systemctl --no-pager --type=service | grep pve-vbmc
|