18.6. ベアメタルデプロイメント用の Ignition 設定の作成
クラウドメタデータサービスを使用せずにベアメタルサーバーをプロビジョニングするには、Ignition 設定ファイルを作成し、それをブートパーティションに配置できます。
前提条件
-
Ignition が有効な
bootcイメージがある。bootc コンテナーイメージでの Ignition の有効化 を参照してください。 - ターゲットシステムのブートメディアにアクセスできる。
Butane YAML 設定を Ignition JSON に変換するために、
butaneユーティリティーがローカルマシンにインストールされている。$ sudo dnf install -y butane
手順
config.buという名前の Butane 設定ファイルを作成します。variant: r4e version: 1.5.0 passwd: users: - name: core ssh_authorized_keys: - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAB... user@example.com storage: files: - path: /etc/hostname mode: 0644 contents: inline: bootc-server-01 - path: /etc/resolv.conf mode: 0644 contents: inline: | nameserver 192.168.1.1 nameserver 8.8.8.8 search example.com - path: /etc/chrony.conf mode: 0644 contents: inline: | server ntp1.example.com iburst server ntp2.example.com iburst driftfile /var/lib/chrony/drift makestep 1.0 3 rtcsync systemd: units: - name: custom-firstboot.service enabled: true contents: | [Unit] Description=Custom first boot configuration After=network-online.target Wants=network-online.target ConditionFirstBoot=yes [Service] Type=oneshot ExecStart=/usr/bin/echo "First boot configuration complete" [Install] WantedBy=multi-user.targetButane 設定を Ignition JSON 形式に変換します。
$ butane --strict config.bu > config.ignターゲットシステムのブートパーティション上に
/boot/ignition/ディレクトリーを作成します。$ mkdir -p /mnt/boot/ignitionIgnition 設定ファイルを
/boot/ignition/ディレクトリーにコピーします。$ cp config.ign /mnt/boot/ignition/config.ign必要なカーネルパラメーターを渡すようにブートローダーを設定します。カーネルコマンドラインに以下のパラメーターを追加します。
ignition.platform.id=metal ignition.firstboot-
設定済みのメディアからシステムをブートします。
initramfsフェーズ中に、Ignition により設定が読み込まれて適用されます。
検証
システム起動後、設定ファイルで指定した SSH 鍵を使用してログインします。
$ ssh core@<server_ip>ホスト名を確認します。
$ hostnamectlDNS 設定が適用されていることを確認します。
$ cat /etc/resolv.confIgnition ログを表示してエラーがないか確認します。
$ journalctl -u ignition-files.service