added BMC/IPMI configure overlay script
This commit is contained in:
44
go.mod
44
go.mod
@@ -3,11 +3,55 @@ module github.com/hpcng/warewulf
|
||||
go 1.15
|
||||
|
||||
require (
|
||||
github.com/BurntSushi/toml v0.3.1
|
||||
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5
|
||||
github.com/beorn7/perks v1.0.1
|
||||
github.com/containerd/containerd v1.3.2
|
||||
github.com/containers/image/v5 v5.7.0
|
||||
github.com/containers/libtrust v0.0.0-20190913040956-14b96171aa3b
|
||||
github.com/containers/ocicrypt v1.0.3
|
||||
github.com/containers/storage v1.23.6
|
||||
github.com/docker/distribution v2.7.1+incompatible
|
||||
github.com/docker/docker v1.4.2-0.20191219165747-a9416c67da9f
|
||||
github.com/docker/docker-credential-helpers v0.6.3
|
||||
github.com/docker/go-connections v0.4.0
|
||||
github.com/docker/go-metrics v0.0.1
|
||||
github.com/docker/go-units v0.4.0
|
||||
github.com/ghodss/yaml v1.0.0
|
||||
github.com/gogo/protobuf v1.3.1
|
||||
github.com/golang/protobuf v1.4.2
|
||||
github.com/gorilla/mux v1.7.4
|
||||
github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a
|
||||
github.com/kelseyhightower/envconfig v1.4.0
|
||||
github.com/klauspost/compress v1.11.1
|
||||
github.com/klauspost/pgzip v1.2.5
|
||||
github.com/lunixbochs/vtclean v0.0.0-20180621232353-2d01aacdc34a
|
||||
github.com/manifoldco/promptui v0.8.0
|
||||
github.com/mattn/go-colorable v0.1.6
|
||||
github.com/mattn/go-isatty v0.0.12
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1
|
||||
github.com/mtrmac/gpgme v0.1.2
|
||||
github.com/opencontainers/go-digest v1.0.0
|
||||
github.com/opencontainers/image-spec v1.0.2-0.20190823105129-775207bd45b6
|
||||
github.com/opencontainers/umoci v0.4.6
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/prometheus/client_golang v1.1.0
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4
|
||||
github.com/prometheus/common v0.6.0
|
||||
github.com/prometheus/procfs v0.0.3
|
||||
github.com/russross/blackfriday/v2 v2.0.1
|
||||
github.com/sirupsen/logrus v1.7.0
|
||||
github.com/spf13/cobra v1.1.1
|
||||
github.com/ulikunitz/xz v0.5.8
|
||||
github.com/vbauerster/mpb/v5 v5.3.0
|
||||
go.etcd.io/bbolt v1.3.5
|
||||
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9
|
||||
golang.org/x/net v0.0.0-20200602114024-627f9648deb9
|
||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a
|
||||
golang.org/x/sys v0.0.0-20200909081042-eff7692f9009
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013
|
||||
google.golang.org/grpc v1.27.0
|
||||
google.golang.org/protobuf v1.24.0
|
||||
gopkg.in/square/go-jose.v2 v2.3.1
|
||||
gopkg.in/yaml.v2 v2.3.0
|
||||
)
|
||||
|
||||
4
go.sum
4
go.sum
@@ -46,9 +46,11 @@ github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJm
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
||||
github.com/checkpoint-restore/go-criu/v4 v4.0.2/go.mod h1:xUQBLp4RLc5zJtWY++yjOoMoB5lihDt7fai+75m+rGw=
|
||||
github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE=
|
||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8=
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
github.com/cilium/ebpf v0.0.0-20200507155900-a9f01edf17e3/go.mod h1:XT+cAw5wfvsodedcijoh1l9cf7v1x9FlFB/3VmF/O8s=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
@@ -62,8 +64,6 @@ github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv
|
||||
github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0=
|
||||
github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o=
|
||||
github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc=
|
||||
github.com/containers/image v1.5.1 h1:ssEuj1c24uJvdMkUa2IrawuEFZBP12p6WzrjNBTQxE0=
|
||||
github.com/containers/image v3.0.2+incompatible h1:B1lqAE8MUPCrsBLE86J0gnXleeRq8zJnQryhiiGQNyE=
|
||||
github.com/containers/image/v5 v5.7.0 h1:fiTC8/Xbr+zEP6njGTZtPW/3UD7MC93nC9DbUoWdxkA=
|
||||
github.com/containers/image/v5 v5.7.0/go.mod h1:8aOy+YaItukxghRORkvhq5ibWttHErzDLy6egrKfKos=
|
||||
github.com/containers/libtrust v0.0.0-20190913040956-14b96171aa3b h1:Q8ePgVfHDplZ7U33NwHZkrVELsZP5fYj9pM5WBZB2GE=
|
||||
|
||||
@@ -34,6 +34,8 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
|
||||
for _, node := range nodeList {
|
||||
|
||||
var powerCmd power.PowerOnInterface
|
||||
|
||||
if node.IpmiIpaddr == "" {
|
||||
wwlog.Printf(wwlog.ERROR, "%s: No IPMI IP address\n", node.HostName)
|
||||
continue
|
||||
@@ -46,7 +48,9 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
AuthType: "MD5",
|
||||
}
|
||||
|
||||
out, err := ipmiCmd.PowerOn()
|
||||
powerCmd = ipmiCmd
|
||||
|
||||
out, err := powerCmd.PowerOn()
|
||||
|
||||
if err != nil {
|
||||
wwlog.Printf(wwlog.ERROR, "%s: %s\n", node.HostName, out)
|
||||
|
||||
22
internal/pkg/power/power.go
Normal file
22
internal/pkg/power/power.go
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
package power
|
||||
|
||||
//type PowerControl interface {
|
||||
//PowerOn() (result string, err error)
|
||||
//PowerOff() (result string, err error)
|
||||
//PowerStatus() (result string, err error)
|
||||
//}
|
||||
|
||||
type PowerOnInterface interface {
|
||||
PowerOn() (result string, err error)
|
||||
}
|
||||
|
||||
type PowerOffInterface interface {
|
||||
PowerOff() (result string, err error)
|
||||
}
|
||||
|
||||
type PowerStatusInterface interface {
|
||||
PowerStatus() (result string, err error)
|
||||
}
|
||||
|
||||
|
||||
50
overlays/system/default/ipmi.ww
Executable file
50
overlays/system/default/ipmi.ww
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
|
||||
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
||||
|
||||
if [ ! -e /dev/ipmi0 ]; then
|
||||
ipmi_dev=$(grep ipmidev /proc/devices | awk '{ print $1; }')
|
||||
mknod -m 0666 /dev/ipmi0 c $ipmi_dev 0
|
||||
ls -la /dev/ipmi0
|
||||
fi
|
||||
|
||||
IP="{{.IpmiIpaddr}}"
|
||||
NETMASK="{{.NetDevs.eth0.Netmask}}"
|
||||
GATEWAY="{{.NetDevs.eth0.Gateway}}"
|
||||
USER="{{.IpmiUserName}}"
|
||||
PASS="{{.IpmiPassword}}"
|
||||
|
||||
echo IP is $IP
|
||||
echo NETMASK is $NETMASK
|
||||
echo GATEWAY is $GATEWAY
|
||||
echo USER is $USER
|
||||
echo PASS is $PASS
|
||||
|
||||
exit 0
|
||||
|
||||
# Network
|
||||
ipmitool lan set 1 ipsrc static
|
||||
ipmitool lan set 1 ipaddr $IP
|
||||
ipmitool lan set 1 netmask $NETMASK
|
||||
|
||||
# Authentication
|
||||
ipmitool lan set 1 auth user md5,password
|
||||
ipmitool lan set 1 auth operator md5,password
|
||||
ipmitool lan set 1 auth admin md5,password
|
||||
ipmitool user enable 1
|
||||
ipmitool user priv 1 4 1
|
||||
|
||||
# Authentication (allow None)
|
||||
#ipmitool lan set 1 auth user none,md5,password
|
||||
#ipmitool lan set 1 auth operator none,md5,password
|
||||
#ipmitool lan set 1 auth admin none,md5,password
|
||||
#ipmitool user enable 1
|
||||
#ipmitool user priv 1 4 1
|
||||
|
||||
# Serial Over LAN
|
||||
ipmitool sol set force-encryption true 1
|
||||
ipmitool sol set force-authentication true 1
|
||||
ipmitool sol set privilege-level user 1
|
||||
ipmitool sol set non-volatile-bit-rate 19.2 1
|
||||
ipmitool sol set volatile-bit-rate 19.2 1
|
||||
|
||||
Reference in New Issue
Block a user