0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Foreman から BMC 操作をする

Last updated at Posted at 2025-10-10

概要

以前、以下の記事で Foreman の基本的な構築を行いました。
https://qiita.com/masamokkulu/items/472e72df536cc76fa871

Foreman(Smart Proxy)は IPMITOOL や Redfish を用いたサーバ操作に対応しているため、デプロイしたベアメタルサーバを BMC で操作できるようにしていきます。今回は IPMITOOL を使用します。

Requirements

A. IPMI-TOOL

Foreman サーバ上で ipmitool を実行できるよう設定する必要があります。ipmitool は DELL などサーバベンダから専用のものが公開されている場合もありますが、こだわりが無ければ apt で問題ないはずです。

root@foreman-test:~# apt install ipmitool

B. IPMI 環境

当然ですが、BMC を有している環境(物理サーバ)が必要です。
なお、Foreman 上ではベアメタルプロビジョニングしたサーバそれ自体と BMC を別々に管理していますので、極論 VM を PXE ブートでベアメタルプロビジョニングし、そこに別途物理サーバの BMC を紐づけるようなことも可能です。

試していませんが、例えば以下のような IPMI シミュレータを活用する手もあるかもしれません。
https://qiita.com/infrajp/items/35bdef700f81b9a0565e

兎に角、以下のように ipmitool での通信ができれば今は OK です。

root@foreman-test:~# sudo -u foreman-proxy ipmitool -I lanplus -H xxx.xxx.xxx.xxx -U user -P p@ssw0rd chassis status
...

C. Smart Proxy の設定

Smart Proxy で BMC 管理機能を有効にします。

root@foreman-test:~# foreman-installer --foreman-proxy-bmc="true" --foreman-proxy-bmc-ssh-poweron="true"

念のため以下も設定しておきます。

root@foreman-test:~# vim /etc/foreman-proxy/settings.d/bmc.yml 
---
# Can be true, false, or http/https to enable just one of the protocols
:enabled: true <<< 変更

# Available providers:
# - freeipmi / ipmitool - requires the appropriate package installed, and the rubyipmi gem
# - redfish - requires the redfish_client gem
# - shell - for local reboot control (requires sudo access to /sbin/shutdown for the proxy user)
# - ssh - limited remote control (status, reboot, turn off)
:bmc_default_provider: ipmitool

root@foreman-test:~# systemctl restart foreman-proxy.service

Smart Proxy の管理画面で BMC に対応していれば OK です。
image.png

D. Known Issue への対処

最近の Foreman では rubyipmi のバーションが上がったことで ipmitool とうまく連携が出来ないという既知問題があるようです。私も実際に v3.16 で遭遇しました。
Foreman サーバ上の ruby-rubyipmi のバーションが 0.12.0 の場合は 0.11.0 にダウングレードしてください。

設定手順

事前準備が出来たらさっそくベアメタルサーバに適用していきます。

1. サブネット設定

[インフラストラクチャー] > [サブネット] から BMC 用のサブネットを作成していきます。

サブネット タブ

項目 備考
名前 BMC NW -
ネットワークアドレス 192.168.200.0 IPMI 通信ができる NW レンジ
ネットワークプレフィック 24 環境に合わせて変更

プロキシー タブ

BMC プロキシーで foreman-test.example.com を選択。

2. ホスト作成

ホスト作成の手順は基本的にこれまで通りですが、インタフェースで追加の作業が発生します。以下のような BMC 用インタフェースを作成してください。

項目 備考
Type BMC -
IPv4 サブネット BMC NW 先ほど作成したもの
IPv4 アドレス 192.168.200.X IPMI のアドレス
管理 チェックを外す -
プライマリー チェックを外す -
プロビジョン チェックを外す -
ユーザ名 user ipmitool でアクセスする際のユーザ名
パスワード p@ssw0rd ipmitool でアクセスする際のパスワード
プロバイダー IPMI RedfishSSH も選べる模様

"管理" のチェックを外すところがポイントです。
今回、BMC へはプロビジョンされたサーバからではなく Foreman 上からアクセス、管理しますので、サーバ側に無駄なインタフェースや NW 設定は入ってほしくありません。このチェックを外せばサーバ側に何らかの設定が入ったり監視されることを防げます。

これでプロビジョニングを開始すれば OK です。

3. 動作確認

成功すると画面のように電源アイコンが緑色になり、操作が可能になります。オフにすれば IPMI 経由で操作が走り、電源オフが実行されます。
image.png

また、三点リーダ(…)から「レガシーUI」に切り返るともう少し詳細な画面が得られます。こちらではリセットなドもう少し詳細な操作が可能になるようです。
image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?