Skip to content

Commit 9b1459d

Browse files
Merge pull request #1368 from flyingcircusio/PL-133561-make-managing-ipmi-admin-names-optional
ipmi: make changing the IPMI admin username optional
2 parents 057f7c4 + ade095f commit 9b1459d

File tree

2 files changed

+49
-20
lines changed

2 files changed

+49
-20
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!--
2+
3+
A new changelog entry.
4+
5+
Delete placeholder items that do not apply. Empty sections will be removed
6+
automatically during release.
7+
8+
Leave the XX.XX as is: this is a placeholder and will be automatically filled
9+
correctly during the release and helps when backporting over multiple platform
10+
branches.
11+
12+
-->
13+
14+
### Impact
15+
16+
17+
### NixOS XX.XX platform
18+
19+
- Make managing the IPMI admin username optional. Some machines do not support changing the name. (PL-133561)

nixos/platform/ipmi.nix

+30-20
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ in
3838
description = "Additional options to pass to `check_ipmi_sensor`.";
3939
type = types.str;
4040
};
41+
manageAdminUserName = mkOption {
42+
default = true;
43+
description = "Manage the admin user name (setting it to `ADMIN`).";
44+
type = types.bool;
45+
};
4146
};
4247
};
4348

@@ -82,26 +87,31 @@ in
8287
serviceConfig.RemainAfterExit = true;
8388
path = [ pkgs.ipmitool ];
8489
wantedBy = [ "basic.target" ];
85-
script = ''
86-
ipmitool lan set 1 ipsrc static
87-
sleep 1
88-
ipmitool lan set 1 ipaddr ${ipmi_addr}
89-
sleep 1
90-
ipmitool lan set 1 netmask ${ipmi_netmask}
91-
sleep 1
92-
ipmitool lan set 1 defgw ipaddr ${ipmi_gw}
93-
sleep 1
94-
ipmitool sol set non-volatile-bit-rate 115.2 1
95-
sleep 1
96-
ipmitool sol set volatile-bit-rate 115.2 1
97-
sleep 1
98-
ipmitool user set name 2 ADMIN
99-
# See https://serverfault.com/questions/361940/configuring-supermicro-ipmi-to-use-one-of-the-lan-interfaces-instead-of-the-ipmi/677087
100-
# Ensure BMC is set to failover (SuperMicro only)
101-
if ipmitool mc info | grep Supermicro > /dev/null ; then
102-
ipmitool raw 0x30 0x70 0x0c 1 2 || true
103-
fi
104-
'';
90+
script =
91+
''
92+
ipmitool lan set 1 ipsrc static
93+
sleep 1
94+
ipmitool lan set 1 ipaddr ${ipmi_addr}
95+
sleep 1
96+
ipmitool lan set 1 netmask ${ipmi_netmask}
97+
sleep 1
98+
ipmitool lan set 1 defgw ipaddr ${ipmi_gw}
99+
sleep 1
100+
ipmitool sol set non-volatile-bit-rate 115.2 1
101+
sleep 1
102+
ipmitool sol set volatile-bit-rate 115.2 1
103+
sleep 1
104+
''
105+
+ (lib.optionalString cfg.ipmi.manageAdminUserName ''
106+
ipmitool user set name 2 ADMIN
107+
'')
108+
+ ''
109+
# See https://serverfault.com/questions/361940/configuring-supermicro-ipmi-to-use-one-of-the-lan-interfaces-instead-of-the-ipmi/677087
110+
# Ensure BMC is set to failover (SuperMicro only)
111+
if ipmitool mc info | grep Supermicro > /dev/null ; then
112+
ipmitool raw 0x30 0x70 0x0c 1 2 || true
113+
fi
114+
'';
105115
};
106116

107117
flyingcircus.passwordlessSudoPackages = [

0 commit comments

Comments
 (0)