自動インストールプロファイル

SUSE Multi-Linux Manager内では、インストールするクライアントのオペレーティングシステムに応じて、2つの異なる種類のプロファイルを使用できます。

  • SUSE Linux EnterpriseクライアントまたはopenSUSEクライアントの場合、AutoYaSTを使用します。

  • Red Hat Enterprise Linuxクライアントの場合、Kickstartを使用します。

自動インストールプロファイルによって、オペレーティングシステムをインストールする方法が決定されます。 たとえば、インストーラに渡す追加のカーネルパラメータを指定できます。

プロファイルの最も重要な部分は、自動インストールファイルです。 インストールを手動で実行する場合、パーティション設定、ネットワーク情報、ユーザの詳細などの情報をインストーラに提供する必要があります。 自動インストールファイルは、スクリプト形式でこの情報を提供する方法です。 このタイプのファイルは、回答ファイルと呼ばれることもあります。

異なるオペレーティングシステムでクライアントをインストールする場合、AutoYaSTプロファイルとKickstartプロファイルの両方を使用できます。

プロファイルに含まれる自動インストールファイルには、変数とコードスニペットを格納できます。 変数とコードスニペットについては、テンプレートの構文を参照してください。

1. プロファイルを宣言する

自動インストールファイルとディストリビューションの準備ができたら、プロファイルを作成して、SUSE Multi-Linux Managerサーバで自動インストールを管理できます。プロファイルにより、選択したこのディストリビューションのインストール方法が決定されます。プロファイルを作成する1つの方法はAutoYaSTファイルまたはKickstartファイルをアップロードする方法です。または、Kickstartのみの場合、Web UIウィザードを使用できます。

プロシージャ: アップロードによる自動インストールプロファイルの作成
  1. SUSE Multi-Linux ManagerのWeb UIで、システム  自動インストール  プロファイルに移動します。

  2. キックスタート/AutoYaSTファイルをアップロードをクリックします。

  3. In the Label field, type a name for the profile. Do not use spaces.

  4. In the Autoinstall Tree field, select the autoinstallable distribution to use for this profile.

  5. In the Virtualization Type field, select the type of virtualization to use for this profile, or select None if you do not want to use this profile to create a new virtual machine.

  6. Copy the contents of your autoinstallation file into the File Contents field, or upload the file directly using the File to Upload field.

    ここに記載する詳細については、AutoYaSTプロファイルまたはKickstartプロファイルを参照してください。

  7. 作成をクリックしてプロファイルを作成します。

プロシージャ: ウィザードでKickstartプロファイルを作成する
  1. SUSE Multi-Linux ManagerのWeb UIで、システム  自動インストール  プロファイルに移動します。

  2. キックスタートプロファイルを作成をクリックします。

  3. In the Label field, type a name for the profile. Do not use spaces.

  4. In the Base Channel field, select the base channel to use for this profile. This field is populated from the distributions available. If the base channel you need is not available, check that you have created the distribution correctly.

  5. In the Virtualization Type field, select the type of virtualization to use for this profile, or select None for no virtualization.

  6. 次へをクリックします。

  7. In the Distribution File Location type the path to the installation media installed on the SUSE Multi-Linux Manager Server.

  8. 次へをクリックします。

  9. クライアントのrootユーザのパスワードを入力します。

  10. 完了をクリックします。

  11. 新しいプロファイルの詳細を確認し、必要に応じてカスタマイズします。

When you are creating your autoinstallation profile, you can check Always use the newest Tree for this base channel. This setting allows SUSE Multi-Linux Manager to automatically pick the latest distribution that is associated with the specified base channel. If you add new distributions later, SUSE Multi-Linux Manager uses the most recently created or modified.

Changing the Virtualization Type usually requires changes to the profile bootloader and partition options. This can overwrite your customization. Verify new or changed settings before saving them, by navigating to the Partitioning tab.

ディストリビューションとプロファイルのカーネルオプションは統合されます。

自動インストールプロファイルの詳細および設定を変更できます。そのためには、システム  自動インストール  プロファイルに移動し、編集するプロファイルの名前をクリックします。 または、システム  システム一覧に移動し、プロビジョニングするクライアントを選択し、プロビジョニング  自動インストールサブタブに移動します。

2. AutoYaSTプロファイル

An AutoYaST profile consists of a Label that identifies the profile, an Autoinstall Tree that points to an autoinstallable distribution, various options, and, most importantly, an AutoYaST installation file.

AutoYaSTインストールファイルは、AutoYaSTインストーラに指示を与えるXMLファイルです。AutoYaSTでは、「制御ファイル」と呼ばれます。 AutoYaSTインストールファイルの構文の詳細については、https://doc.opensuse.org/projects/autoyast/#cha-configuration-installation-optionsを参照してください。

SUSE provides templates of AutoYaST installation files that you can use as a starting point for your own custom files. You will find the templates at https://github.com/SUSE/manager-build-profiles in the AutoYast directory. Each of these profiles requires you to set some variables before you use it. Check the README file included with the script to determine which variables you need. For more information about using variables in AutoYaST scripts, see Variables.

提供されているAutoYaSTテンプレートでは、ユーザパスワードは設定されません。 rootアカウントやその他のユーザアカウントとパスワード、またはその他の認証手段の設定を検討してください。 AutoYaSTプロファイル内のユーザアカウントの詳細については、https://doc.opensuse.org/projects/autoyast/#Configuration-Security-users-and-groupsを参照してください。

SUSE Multi-Linux ManagerでインストールするためのAutoYaSTインストールファイルで、最も重要なセクションを次に示します。

AutoYaSTの詳細については、https://doc.opensuse.org/projects/autoyast/を参照してください。

AutoYaSTに代わるSaltベースの最近のプロファイルには、Yomiがあります。Yomiについては、Yomiを使用してインストールするを参照してください。

3. キックスタートプロファイル

Kickstartプロファイルには、多数の設定オプションがあります。 プロファイルを作成するには、プロファイルをアップロードするか、専用のウィザードを使用します。

Kickstartプロファイルでは、ファイル保持一覧を使用できます。 Kickstartで再インストールするクライアントにあるカスタム設定ファイルが多数ある場合、リストにしてこれらのファイルを保存し、そのリストをKickstartプロファイルに関連付けることができます。

プロシージャ: ファイル保持一覧の作成
  1. SUSE Multi-Linux ManagerのWeb UIで、システム  自動インストール  ファイル保持に移動し、ファイル保持一覧の作成をクリックします。

  2. 適切なラベルを入力し、保存するすべてのファイルおよびディレクトリへの絶対パスをリストします。

  3. 一覧の作成をクリックします。

  4. Kickstartプロファイルにファイル保持一覧を含めます。

  5. システム  自動インストール  プロファイルに移動して編集するプロファイルを選択し、システムの詳細  ファイル保持サブタブに移動して、含めるファイル保持一覧を選択します。

File preservation lists are limited to a total size of 1 MB. Special devices like /dev/hda1 and /dev/sda1 cannot be preserved. Only use file and directory names, you cannot use regular expression wildcards.

Kickstartの詳細については、Red Hatのドキュメントを参照してください。

4. テンプレートの構文

インストールファイルの一部は、インストール中に置き換えられます。 変数は単一の値に置き換えられ、コードスニペットはテキストのセクション全体に置き換えられます。 エスケープされた記号やセクションは置き換えられません。

CobblerはCheetahと呼ばれるテンプレートエンジンを使用して、このような置き換えを実行できます。このメカニズムにより、システムごとにプロファイルを手動で作成する必要なく、多数のシステムを再インストールできます。

You can create autoinstallation variables and code snippets within the SUSE Multi-Linux Manager Web UI. Within a profile, the Autoinstallation File tab allows you to see the result of the substitutions.

  • 変数については、変数を参照してください。

  • コードスニペットについては、コードスニペットを参照してください。

  • エスケープ記号またはテキストブロックについては、エスケープを参照してください。

4.1. 変数

Autoinstallation variables can be used to substitute values into Kickstart and AutoYaST profiles. To define a variable, from the profile, navigate to the Variables subtab, and create a name=value pair in the text box.

For example, you could create a variable that holds the IP address of the client, and another that holds the address of its gateway. Those variables can then be defined for all the clients installed from the same profile. To do that, add these lines to the Variables text box:

ipaddr=192.168.0.28
gateway=192.168.0.1

To use the variable, prepend a $ sign in the profile to substitute the value. For example, the network part of a Kickstart file may look like the following:

network --bootproto=static --device=eth0 --onboot=on --ip=$ipaddr \
  --gateway=$gateway

The $ipaddr is resolved to 192.168.0.28, and the $gateway to 192.168.0.1.

インストールファイルでは、変数は階層的に使用します。 システム変数はプロファイル変数より優先され、プロファイル変数はディストリビューション変数より優先されます。

4.2. コードスニペット

SUSE Multi-Linux Managerには、多数の定義済みコードスニペットが付属しています。システム  自動インストール  自動インストールスニペットに移動し、既存のスニペットの一覧を表示します。

Use a snippet by inserting the $SNIPPET() macro in your autoinstallation file. For example, in Kickstart:

$SNIPPET('spacewalk/redhat_register_using_salt')

または、AutoYaSTでは次のようになります。

<init-scripts config:type="list">
  $SNIPPET('spacewalk/minion_script')
</init-scripts>

このマクロはCobblerによって解析され、スニペットの内容に置き換えられます。独自のコードスニペットを保存して、後で自動インストールファイルで使用することもできます。スニペットの作成をクリックして、新しいコードスニペットを作成します。

この例では、一般的なハードドライブのパーティション設定のKickstartスニペットが設定されます。

clearpart --all
part /boot --fstype ext3 --size=150 --asprimary
part / --fstype ext3 --size=40000 --asprimary
part swap --recommended

part pv.00 --size=1 --grow

volgroup vg00 pv.00
logvol /var --name=var vgname=vg00 --fstype ext3 --size=5000

たとえば、次のようにスニペットを使用します。

$SNIPPET('my_partition')

4.3. エスケープ

If the autoinstallation file contains shell script variables like $(example), the content needs to be escaped with a backslash: \$(example). Escaping the $ symbol prevents the templating engine from evaluating the symbol as an internal variable.

Text blocks such as code fragments or scripts can be escaped by wrapping them with the \#raw and \#end raw directives. For example:

#raw
#!/bin/bash
for i in {0..2}; do
 echo "$i - Hello World!"
done
#end raw

Any line with a # symbol followed by a whitespace is treated as a comment and is therefore not evaluated. For example:

# start some section (this is a comment)
echo "Hello, world"
# end some section (this is a comment)