Set an IPMI tag `vlan to configure the vlan during ipmiwrite`

- Closes: #1031

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2025-03-22 02:12:13 -06:00
parent 2cf123d26a
commit d982fea6da
4 changed files with 21 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Added `wwctl overlay import --overwrite` to overwrite existing overlay file. - Added `wwctl overlay import --overwrite` to overwrite existing overlay file.
- wwclient uses `WW_IPADDR`, if set, to contact the Warewulf server. #1788 - wwclient uses `WW_IPADDR`, if set, to contact the Warewulf server. #1788
- Add `wwctl node import --yes` to assume yes to confirmations. - Add `wwctl node import --yes` to assume yes to confirmations.
- Set an IPMI tag ``vlan`` to configure the vlan during ``ipmiwrite``. #1031
### Fixed ### Fixed

View File

@@ -8,3 +8,6 @@ WWIPMI_GATEWAY="{{$.Ipmi.Gateway}}"
WWIPMI_USER="{{$.Ipmi.UserName}}" WWIPMI_USER="{{$.Ipmi.UserName}}"
WWIPMI_PASSWORD="{{$.Ipmi.Password}}" WWIPMI_PASSWORD="{{$.Ipmi.Password}}"
WWIPMI_WRITE="{{$.Ipmi.Write.Bool}}" WWIPMI_WRITE="{{$.Ipmi.Write.Bool}}"
{{- if $.Ipmi.Tags.vlan }}
WWIPMI_VLAN="{{$.Ipmi.Tags.vlan}}"
{{- end }}

View File

@@ -32,6 +32,16 @@ command -v ipmitool >/dev/null 2>&1 || (
lan_info="$(ipmitool lan print 1)" lan_info="$(ipmitool lan print 1)"
if [ -n "$WWIPMI_VLAN" ]; then
prev_vlan=$(echo "$lan_info" | grep "^802.1q VLAN ID *:" | awk -F': ' '{print $2 }')
if [ "$prev_vlan" == "$WWIPMI_VLAN" ] || [ "$prev_vlan" = "Disabled" -a "$WWIPMI_VLAN" = off ]; then
echo "IPMI VLAN: $WWIPMI_VLAN"
else
echo "IPMI VLAN: $prev_vlan -> $WWIPMI_VLAN"
echo ipmitool lan set 1 vlan id "$WWIPMI_VLAN"
fi
fi
if [ -n "$WWIPMI_IPADDR" ]; then if [ -n "$WWIPMI_IPADDR" ]; then
prev_ip=$(echo "$lan_info" | grep "^IP Address *:" | awk -F': ' '{ print $2 }') prev_ip=$(echo "$lan_info" | grep "^IP Address *:" | awk -F': ' '{ print $2 }')
if [ "$prev_ip" != "$WWIPMI_IPADDR" ]; then if [ "$prev_ip" != "$WWIPMI_IPADDR" ]; then

View File

@@ -28,6 +28,13 @@ desired IPMI configuration to the node's BMC during boot.
wwctl node set n1 \ wwctl node set n1 \
--ipmiaddr=192.168.2.1 --ipmiaddr=192.168.2.1
Additionally, a ``vlan`` ipmi tag can be used to set the IPMI VLAN ID.
.. code-block::
wwctl profile set default \
--ipmitagadd vlan=42
``wwctl node list`` has a specific overview for IPMI settings. ``wwctl node list`` has a specific overview for IPMI settings.
.. code-block:: console .. code-block:: console