第8章 RHEL for Edge Simplified Installer イメージ用の Ignition ツールの使用
RHEL for Edge は、Ignition ツールを使用して、ブートプロセスの初期段階でユーザー設定をイメージに注入します。Ignition ツールが注入するユーザー設定には次のものが含まれます。
- ユーザー設定。
-
通常のファイルや
systemd
ユニットなどのファイルの書き込み。
最初の起動時に、Ignition はリモート URL または Simplified Installer ISO に埋め込まれたファイルから設定を読み取ります。その後、Ignition はその設定をイメージに適用します。
8.1. Ignition 設定ファイルの作成
Butane
ツールは、Ignition 設定ファイルを作成するのに推奨されるオプションです。Butane
は Butane Config YAML
ファイルを使用して、JSON 形式で Ignition Config
を生成します。JSON ファイルは、システムの最初の起動時に使用されます。Ignition Config
は、ユーザーの作成や systemd
ユニットのインストールなど、イメージ内の設定を適用します。
前提条件
Butane ツールのバージョン v0.17.0 がインストールされている。
$ sudo dnf/yum install -y butane
手順
Butane Config
ファイルを作成し、.bu
形式で保存します。RHEL for Edge イメージの場合は、variant
エントリーをr4e
として指定し、version
エントリーを1.0.0
として指定する必要があります。バージョン 1.0.0 の Butaner4e
バリアントは、Ignition 仕様バージョン3.3.0
をターゲットとしています。以下は Butane Config YAML ファイルの例です。variant: r4e version: 1.0.0 ignition: config: merge: - source: http://192.168.122.1:8000/sample.ign passwd: users: - name: core groups: - wheel password_hash: password_hash_here ssh_authorized_keys: - ssh-ed25519 some-ssh-key-here storage: files: - path: /etc/NetworkManager/system-connections/enp1s0.nmconnection contents: inline: | [connection] id=enp1s0 type=ethernet interface-name=enp1s0 [ipv4] address1=192.168.122.42/24,192.168.122.1 dns=8.8.8.8; dns-search= may-fail=false method=manual mode: 0600 - path: /usr/local/bin/startup.sh contents: inline: | #!/bin/bash echo "Hello, World!" mode: 0755 systemd: units: - name: hello.service contents: | [Unit] Description=A hello world [Install] WantedBy=multi-user.target enabled: true - name: fdo-client-linuxapp.service dropins: - name: log_trace.conf contents: | [Service] Environment=LOG_LEVEL=trace
次のコマンドを実行して、
Butane Config YAML
ファイルを使用し、JSON 形式で Ignition Config を生成します。$ ./path/butane example.bu {"ignition":{"config":{"merge":[{"source":"http://192.168.122.1:8000/sample.ign"}]},"timeouts":{"httpTotal":30},"version":"3.3.0"},"passwd":{"users":[{"groups":["wheel"],"name":"core","passwordHash":"password_hash_here","sshAuthorizedKeys":["ssh-ed25519 some-ssh-key-here"]}]},"storage":{"files":[{"path":"/etc/NetworkManager/system-connections/enp1s0.nmconnection","contents":{"compression":"gzip","source":"data:;base64,H4sIAAAAAAAC/0yKUcrCMBAG3/csf/ObUKQie5LShyX5SgPNNiSr0NuLgiDzNMPM8VBFtHzoQjkxtPp+ITsrGLahKYyyGtoqEYNKwfeZc32OC0lKDb179rfg/HVyPgQ3hv8w/v0WT0k7T+7D/S1Dh7S4MRU5h1XyzqvsHVRg25G4iD5kp1cAAAD//6Cvq2ihAAAA"},"mode":384},{"path":"/usr/local/bin/startup.sh","contents":{"source":"data:;base64,IyEvYmluL2Jhc2gKZWNobyAiSGVsbG8sIFdvcmxkISIK"},"mode":493}]},"systemd":{"units":[{"contents":"[Unit]\nDescription=A hello world\n[Install]\nWantedBy=multi-user.target","enabled":true,"name":"hello.service"},{"dropins":[{"contents":"[Service]\nEnvironment=LOG_LEVEL=trace\n","name":"log_trace.conf"}],"name":"fdo-client-linuxapp.service"}]}}
Butane Config YAML
ファイルを実行してIgnition Config JSON
ファイルをチェックおよび生成すると、サポートされていないフィールド (パーティションなど) を使用している場合に警告が表示されることがあります。これらのフィールドを修正して、チェックを再実行できます。
これで、ブループリントのカスタマイズに使用できる Ignition JSON 設定ファイルが完成しました。