ブートストラップスクリプトを使用してクライアントを登録する

1. 概要

ブートストラップスクリプトでクライアントを登録すると、パラメータを制御できるようになり、同時に多数のクライアントを登録する必要がある場合に役立ちます。

ブートストラップスクリプトを使用してクライアントを登録するには、まずブートストラップスクリプトのテンプレートを作成することをお勧めします。このテンプレートはその後コピーして変更できます。作成したブートストラップスクリプトは、登録時にクライアントで実行され、必要なパッケージがすべてクライアントに展開されていることを確認します。ブートストラップスクリプトに含まれている一部のパラメータによって、クライアントシステムを、アクティベーションキーやGPGキーを使用してそのベースチャンネルに割り当てることができるようになります。

リポジトリ情報を注意深く確認して、ベースチャンネルリポジトリと一致していることを確認することが重要です。 リポジトリ情報が正確に一致しないと、ブートストラップスクリプトは正しいパッケージをダウンロードできません。

追加の考慮事項:

  • すべてのクライアントにブートストラップリポジトリが必要です。製品が同期されると、SUSE Multi-Linux Managerサーバ上で自動的に作成および再生成されます。 ブートストラップリポジトリには、クライアントにSaltをインストールし、クライアントを登録するためのパッケージが用意されています。ブートストラップリポジトリの作成の詳細については、ブートストラップリポジトリを参照してください。

  • デフォルトではopenSUSE Leap 15およびSLE 15はPython 3を使用します。Python 2に基づくブートストラップスクリプトは、openSUSE Leap 15システムおよびSLE 15システム用に再作成する必要があります。Python 2を使用してopenSUSE Leap 15システムまたはSLE 15システムを登録する場合、ブートストラップスクリプトは失敗します。

旧バージョンのSUSE Multi-Linux Managerから新バージョンに移行した後は、新しいシステムをオンボーディングする前に、潜在的な問題を避けるためにブートストラップスクリプトを再生成することを強くお勧めします。

To access a shell inside the server container run mgrctl term on the container host. From there, one can run the CLI tools as usual.

2. Create a bootstrap script with mgr-bootstrap

The mgr-bootstrap command generates custom bootstrap scripts. A bootstrap script is used by SUSE Multi-Linux Manager client systems for simplifying their initial registration and configuration.

The arguments --activation-keys and --script, are the only mandatory arguments. On the SUSE Multi-Linux Manager Server, as root at the command line execute it with the mandatory arguments. Replace <ACTIVATION_KEY and <EDITED_NAME> with your values:

  1. SUSE Multi-Linux Managerコンテナホストのコマンドプロンプトで、 rootユーザとして次のコマンドを実行して、サーバコンテナに入ります。

    mgrctl term
  2. 次のコマンドを実行します(必要に応じて値を調整します)。

    mgr-bootstrap --activation-keys=<ACTIVATION_KEY> --script=bootstrap-<EDITED_NAME>.sh

The mgr-bootstrap command offers several other options, including the ability to set a specific hostname, set specific GPG keys, and set the registration method (salt-minion or salt-bundle).

  • ユーザがプロキシに登録するためのブートストラップ スクリプトを作成したい場合は、サーバコンテナから次のコマンドを使用して作成できます。

    mgr-boostrap --hostname <PROXY_FQDN>

    This command will create a new bootstrap script with default name bootstrap.sh and it will overwrite the existing bootstrap.sh file which is used for the Server.

  • 別のスクリプトを指定するには、次のコマンドを使用します。

    mgr-bootstrap --hostname <PROXY_FQDN> --script=boostrap-<PROXY-SCRIPT>.sh

For more information, see the mgr-bootstrap man page, or run mgr-bootstrap --help.

3. Web UIでのブートストラップスクリプトの作成

SUSE Multi-Linux ManagerのWeb UIを使用して、編集できるブートストラップスクリプトを作成できます。

プロシージャ: ブートストラップスクリプトの作成
  1. SUSE Multi-Linux ManagerのWeb UIで、管理  マネージャ設定  ブートストラップスクリプトに移動します。

  2. 必須フィールドには、前のインストール手順から取り出した値が事前に入力されています。 各設定の詳細については、ブートストラップスクリプトを参照してください。

  3. 更新をクリックしてスクリプトを作成します。

  4. The bootstrap script is generated and stored on the server in the /srv/www/htdocs/pub/bootstrap directory. Alternatively, you can access the bootstrap script over HTTPS. Replace <example.com> with the host name of your SUSE Multi-Linux Manager Server:

    https://<example.com>/pub/bootstrap/bootstrap.sh

Do not disable SSL in your bootstrap script. Ensure that Enable SSL is checked in the Web UI, or that the setting USING_SSL=1 exists in the bootstrap script. If you disable SSL, the registration process requires custom SSL certificates.

カスタム証明書の詳細については、see SSL証明書を参照してください。

4. ブートストラップスクリプトの編集

作成したブートストラップスクリプトのテンプレートをコピーして変更し、カスタマイズできます。 SUSE Multi-Linux Managerで使用するためにブートストラップスクリプトを編集するときの最小要件は、アクティベーションキーを含めることです。 ほとんどのパッケージはGPGで署名されているため、信頼できるGPGキーをシステムで用意してインストールすることも必要です。

In this procedure, you need to know the exact name of your activation keys. Navigate to Home  Overview and, in the Tasks box, click Manage Activation Keys. All keys created for channels are listed on this page. You must enter the full name of the key you wish to use in the bootstrap script exactly as presented in the key field. For more information about activation keys, see アクティベーションキー.

プロシージャ: ブートストラップスクリプトの変更
  1. SUSE Multi-Linux Managerコンテナホストのコマンドプロンプトで、 rootユーザとして次のコマンドを実行して、サーバコンテナに入ります。

    mgrctl term
  2. SUSE Multi-Linux Managerサーバのコマンドラインでrootとして、ブートストラップディレクトリを次のように変更します。

    cd /srv/www/htdocs/pub/bootstrap/
  3. 各クライアントで使用するブートストラップスクリプトのテンプレートのコピーを2つ作成し、名前を変更します。

    cp bootstrap.sh bootstrap-sles12.sh
    cp bootstrap.sh bootstrap-sles15.sh
  4. Open bootstrap-sles15.sh for modification. Scroll down until you can see the text shown below. If exit 1 exists in the file, comment it out by typing a hash or pound sign (#) at the beginning of the line. This activates the script. Enter the name of the key for this script in the ACTIVATION_KEYS= field:

    echo "Enable this script: comment (with #'s) this block (or, at least just"
    echo "the exit below)"
    echo
    #exit 1
    
    # can be edited, but probably correct (unless created during initial install):
    # NOTE: ACTIVATION_KEYS *must* be used to bootstrap a client machine.
    ACTIVATION_KEYS=1-sles15
    ORG_GPG_KEY=

    スクリプトを手動で編集する代わりに、ユーザは実行時に次の環境変数を渡すことができます。

    • ACTIVATION_KEYS: 登録に使用するアクティベーションキー

    • ORG_GPG_KEY: GPGキーのパスまたは識別子

    • REACTIVATION_KEY: 以前に登録されたシステム用の再アクティベーションキー

    • MGR_SERVER_HOSTNAME: クライアントを登録するサーバまたはプロキシのホスト名

    環境変数を使用すると、実行時に動的な入力が可能になり、異なるシステムや環境間で同じブートストラップスクリプトを再利用しやすくなります。

  5. 完了したら、ファイルを保存し、2つ目のブートストラップスクリプトでこの手順を繰り返します。

By default, bootstrap script will try to install venv-salt-minion if it is available in the bootstrap repository and salt-minion if there is no Salt bundle in the bootstrap repository. It is possible to avoid installing Salt bundle and keep using salt-minion if you need it for some reason.

詳細については、Salt Bundleを参照してください。

5. ブートストラップスクリプトを実行してクライアントを登録する

スクリプトの作成を完了したら、このスクリプトを使用してクライアントを登録できます。

プロシージャ: ブートストラップスクリプトの実行
  1. SUSE Multi-Linux Managerコンテナホストのコマンドプロンプトで、 rootユーザとして次のコマンドを実行して、サーバコンテナに入ります。

    mgrctl term
  2. SUSE Multi-Linux Managerサーバで、ブートストラップディレクトリを次のように変更します。

    cd /srv/www/htdocs/pub/bootstrap/
  3. Run this command to execute the bootstrap script on the client; replace EXAMPLE.COM with the host name of your client:

    cat bootstrap-sles15.sh | ssh root@EXAMPLE.COM /bin/bash
  4. または、クライアントで次のコマンドを実行します。

    ACTIVATION_KEYS="17-someactivationkey" \
    MGR_SERVER_HOSTNAME="proxy.example.com" \
    ORG_GPG_KEY="mykey" \
    REACTIVATION_KEY=my-reactivation-key \
    curl -Sks https://server_hostname/pub/bootstrap/bootstrap.sh | /bin/bash

    値を上書きする必要がない場合は、環境変数を完全に省略できます。

    curl -Sks https://server_hostname/pub/bootstrap/bootstrap.sh | /bin/bash

    To avoid problems, make sure the bootstrap script is executed using bash.

    このスクリプトは、前に作成したリポジトリディレクトリにある必要な依存関係をダウンロードします。

  5. スクリプトの実行が完了すると、クライアントが正しく登録されたかどうかを確認できます。SUSE Multi-Linux ManagerのWeb UIを開き、システム  概要に移動して、新しいクライアントがリストされていることを確認します。クライアントがリストされていない場合は、SUSE Multi-Linux ManagerのWeb UIでSalt  キーに移動して、クライアントキーが受け入れられているかどうかを確認します。

SUSE Multi-Linux Managerを使用してクライアントに新しいパッケージまたは更新がインストールされると、エンドユーザライセンスアグリーメント(EULA)が自動的に受け入れられます。 パッケージのEULAを確認するには、Web UIでパッケージ詳細ページを開きます。