第14章 Managing Custom File Type Content

In Satellite, you might require methods of managing and distributing SSH keys and source code files or larger files such as virtual machine images and ISO files. To achieve this, custom products in Red Hat Satellite include repositories for custom file types. This provides a generic method to incorporate arbitrary files in a product.

リポジトリーにファイルをアップロードし、アップストリームの Satellite Server からファイルを同期できます。ファイルをカスタムのファイルタイプリポジトリーに追加すると、特定のバージョンをコンテンツビューに追加して、さまざまな Capsule Server でファイルのリポジトリーを利用可能にするなど、通常の Satellite 管理機能を使用できます。クライアントは、curl -O で、HTTP または HTTPS からファイルをダウンロードする必要があります。

Satellite Server のファイルタイプリポジトリーはカスタム製品に対してのみ作成できますが、ファイルタイプリポジトリーは柔軟に作成できます。Satellite がインストールされているシステム、またはリモートの HTTP サーバーのディレクトリーに個別のファイルタイプリポジトリーを作成して、そのディレクトリーのコンテンツを同期できます。この方法は、Satellite リポジトリーに追加するファイルが複数ある場合に便利です。

14.1. Creating a Custom File Type Repository in Red Hat Satellite

The procedure for creating a custom file type repository is the same as the procedure for creating any custom content, except that when you create the repository, you select the file type. You must create a product and then add a custom repository.

Procedure

To create a custom product, complete the following procedure:

  1. Satellite Web UI で、コンテンツ > 製品 に移動し、製品の作成 をクリックして、以下の詳細情報を入力します。
  2. 名前 フィールドで、製品の名前を入力します。Red Hat Satellite 6 では、名前 に入力した内容に基づいて ラベル フィールドに自動的に入力されます。
  3. オプション: GPG キー の一覧から、製品の GPG キーを選択します。
  4. オプション: 同期プラン リストから製品の同期プランを選択します。
  5. 説明 フィールドに、製品の説明を入力し、保存 をクリックします。

To create a repository for your custom product, complete the following procedure:

  1. In the Products window, select the name of a product that you want to create a repository for.
  2. Click the Repositories tab, and then click New Repository.
  3. 名前 フィールドに、リポジトリーの名前を入力します。Red Hat Satellite 6 では、名前に基づいて、ラベル フィールドに値が自動的に入力されます。
  4. From the Type list, select file.
  5. アップストリーム URL フィールドに、ソースとして使用するアップストリームリポジトリーの URL を入力します。
  6. アップストリームのリポジトリーの SSL 証明書が信頼できる認証機関 (CA) によって署名されていることを確認する場合、SSL の検証 チェックボックスを選択します。
  7. アップストリームのユーザー名 フィールドに、認証に必要な場合にアップストリームリポジトリーのユーザー名を入力します。リポジトリーに認証が必要ない場合はこのフィールドを空にします。
  8. アップストリームのパスワード フィールドに、アップストリームリポジトリーのパスワードを入力します。リポジトリーに認証が必要ない場合はこのフィールドを空にします。
  9. 保存をクリックします。

For CLI Users

  1. Create a Custom Product

    # hammer product create \
    --name "My File Product" \
    --sync-plan "Example Plan" \
    --description "My files" \
    --organization "My_Organization"

    表14.1 Optional Parameters for the hammer product create Command

    OptionDescription

    --gpg-key gpg_key_name

    Key name to search by

    --gpg-key-id gpg_key_id

    GPG key numeric identifier

    --sync-plan sync_plan_name

    Sync plan name to search by

    --sync-plan-id sync_plan_id

    Sync plan numeric identifier

  2. Create a File Type Repository

    # hammer repository create \
    --name "My Files" \
    --content-type "file" \
    --product "My File Product" \
    --organization "My_Organization"

    表14.2 Optional Parameters for the hammer repository create Command

    OptionDescription

    --checksum-type sha_version

    Repository checksum, currently 'sha1' & 'sha256' are supported

    --download-policy policy_name

    Download policy for yum repos (either 'immediate', 'on_demand', or 'background').

    --gpg-key gpg_key_name

    Key name to search by

    --gpg-key-id gpg_key_id

    GPG key numeric identifier

    --mirror-on-sync boolean

    Must this repo be mirrored from the source, and stale RPMs removed, when synced? Set to true or false, yes or no, 1 or 0.

    --publish-via-http boolean

    Must this also be published using HTTP? Set to true or false, yes or no, 1 or 0.

    --upstream-username repository_username

    Upstream repository user, if required for authentication

    --upstream-password repository_password

    Password for the upstream repository user

    --url source_repo_url

    URL of the Source repository

    --verify-ssl-on-sync boolean

    URL の SSL 証明書が信頼できる CA によって署名されているのを Katello が確認する必要がありますか? true または falseyes または no、もしくは 1 または 0 に設定します。

14.2. Creating a Custom File Type Repository in a Local Directory

You can create a custom file type repository, from a directory of files, on the base system where Satellite is installed using the pulp-manifest command. You can then synchronize the files into Satellite Server. When you add files to a file type repository, you can work with the files as with any other repository.

以下の手順を使用して、Satellite がインストールされているベースシステムのディレクトリーにリポジトリーを設定します。リモートサーバーのディレクトリーにファイルタイプリポジトリーを作成するには、「Creating a Remote File Type Repository」を参照してください。

Procedure

To create a file type repository in a local directory, complete the following procedure:

  1. Ensure the Server and Satellite Tools repositories are enabled:

    # subscription-manager repos --enable=rhel-7-server-rpms \
    --enable=rhel-7-server-satellite-tools-6.5-rpms
  2. Install the Pulp Manifest package:

    # yum install python-pulp-manifest
  3. Create a directory that you want to use as the file type repository in the HTTP server’s public folder:

    # mkdir my_file_repo
  4. Add files to the directory or create a test file:

    # touch my_file_repo/test.txt
  5. Enter the Pulp Manifest command to create the manifest:

    # pulp-manifest my_file_repo
  6. Verify the manifest was created:

    # ls my_file_repo
    PULP_MANIFEST test.txt

Importing Files from a File Type Repository

To import files from a file type repository in a local directory, complete the following procedure:

  1. Ensure a custom product exists in Satellite Server.
  2. Satellite Web UI で、コンテンツ > 製品に移動します。
  3. Select the name of a product.
  4. Click the Repositories tab and select New Repository.
  5. 名前 フィールドに、リポジトリーの名前を入力します。Red Hat Satellite 6 では、名前 に入力した内容をもとに、このフィールドに値が自動的に入力されます。
  6. タイプ リストから、リポジトリーのコンテンツタイプを選択します。
  7. アップストリーム URL フィールドに、ソースとして使用するリポジトリーを使用したローカルディレクトリーを入力します (file:///my_file_repo の形式)。
  8. SSL の検証 チェックボックスを選択してリポジトリーの SSL 証明書をチェックするか、SSL の検証 チェックボックスの選択を解除します。
  9. オプション: アップストリームのユーザー名 フィールドに、必要なアップストリームユーザー名を入力します。
  10. オプション: アップストリームのパスワード フィールドに、アップストリームユーザー名のパスワードを入力します。
  11. Select Save to save this repository entry.

Updating a File Type Repository

To update the file type repository, complete the following steps:

  1. Satellite Web UI で、コンテンツ > 製品に移動します。
  2. Select the name of a product.
  3. Select the name of the repository you want to update.
  4. From the Select Action menu, select Sync Now.
  5. Visit the URL where the repository is published to see the files.

14.3. Creating a Remote File Type Repository

You can create a custom file type repository from a directory of files that is external to Satellite Server using the pulp-manifest command. You can then synchronize the files into Satellite Server over HTTP or HTTPS. When you add files to a file type repository, you can work with the files as with any other repository.

以下の手順を使用して、リモートサーバーのディレクトリーにリポジトリーを設定します。Satellite Server がインストールされているベースシステムのディレクトリーにファイルタイプリポジトリーを作成するには、「Creating a Custom File Type Repository in a Local Directory」を参照してください。

Prerequisites

Before you create a remote file type repository, ensure the following conditions exist:

  • You have a Red Hat Enterprise Linux 7 server registered to your Satellite or the Red Hat CDN.
  • Your server has an entitlement to the Red Hat Enterprise Linux Server and Satellite Tools repositories.
  • HTTP サーバーがインストールされている。web サーバーの設定方法は『システム管理者ガイド』における Red Hat Enterprise Linux 7 での「Apache HTTP Server」を参照してください。

Procedure

To create a file type repository in a remote directory, complete the following procedure:

  1. On your remote server, ensure that the Server and Satellite Tools repositories are enabled:

    # subscription-manager repos --enable=rhel-7-server-rpms \
    --enable=rhel-7-server-satellite-tools-6.5-rpms
  2. Install the Pulp Manifest package:

    # yum install python-pulp-manifest
  3. Create a directory that you want to use as the file type repository in the HTTP server’s public folder:

    # mkdir /var/www/html/pub/my_file_repo
  4. Add files to the directory or create a test file:

    # touch /var/www/html/pub/my_file_repo/test.txt
  5. Enter the Pulp Manifest command to create the manifest:

    # pulp-manifest /var/www/html/pub/my_file_repo
  6. Verify the manifest was created:

    # ls /var/www/html/pub/my_file_repo
    PULP_MANIFEST test.txt

Importing Files from a Remote a File Type Repository

To import files from a remote file type repository, complete the following procedure:

  1. Ensure a custom product exists in Satellite Server, or create a custom product. For more information see 「Creating a Custom File Type Repository in Red Hat Satellite」
  2. Satellite Web UI で、コンテンツ > 製品に移動します。
  3. Select the name of a product.
  4. Click the Repositories tab and select New Repository.
  5. 名前 フィールドに、リポジトリーの名前を入力します。Red Hat Satellite 6 では、名前 に入力した内容をもとに、このフィールドに値が自動的に入力されます。
  6. From the Type list, select file.
  7. アップストリーム URL フィールドに、ソースとして使用するアップストリームリポジトリーの URL を入力します。
  8. アップストリームのリポジトリーの SSL 証明書が信頼できる認証機関 (CA) によって署名されていることを確認する場合、SSL の検証 チェックボックスを選択します。
  9. アップストリームのユーザー名 フィールドに、認証に必要な場合にアップストリームリポジトリーのユーザー名を入力します。リポジトリーに認証が必要ない場合はこのフィールドを空にします。
  10. アップストリームのパスワード フィールドに、アップストリームリポジトリーのパスワードを入力します。リポジトリーに認証が必要ない場合はこのフィールドを空にします。
  11. 保存をクリックします。
  12. コンテンツ > 製品 に移動します。更新するリポジトリーが含まれる製品の名前を選択します。
  13. In the product’s window, select the name of the repository you want to update.
  14. From the Select Action menu, select Sync Now.

Visit the URL where the repository is published to view the files.

14.4. Uploading Files To a Custom File Type Repository in Red Hat Satellite

Procedure

To upload files to a custom file type repository, complete the following steps:

  1. Satellite Web UI で、コンテンツ > 製品に移動します。
  2. Select a custom product by name.
  3. Select a file type repository by name.
  4. Click Browse to search and select the file you want to upload.
  5. Click Upload to upload the selected file to Satellite Server.
  6. Visit the URL where the repository is published to see the file.

For CLI Users

# hammer repository upload-content \
--name "My Files" \
--organization "My_Organization" \
--path example_file

The --path option can indicate a file, a directory of files, or a glob expression of files. Globs must be escaped by single or double quotes.

14.5. Downloading Files to a Host From a Custom File Type Repository in Red Hat Satellite

You can download files to a client over HTTPS using curl -O, and optionally over HTTP if the Publish via HTTP repository option is selected.

Prerequisites

Procedure

To download files to a host from a custom file type repository, complete the following procedure:

  1. Satellite Web UI で、コンテンツ > 製品に移動します。
  2. Select a custom product by name.
  3. Select a file type repository by name.
  4. HTTP 経由での公開 が有効になっているかどうかを確認します。有効になっていない場合は、HTTPS を使用するための証明書が必要です。
  5. Copy the URL where the repository is published.

For CLI Users

  1. List the file type repositories.

    # hammer repository list --content-type file
    ---|----------|-----------------|--------------|----
    ID | NAME     | PRODUCT         | CONTENT TYPE | URL
    ---|----------|-----------------|--------------|----
    7  | My Files | My File Product | file         |
    ---|----------|-----------------|--------------|----
  2. Display the repository information.

    # hammer repository info --name "My Files" --product "My File Product" --organization-id 1

    HTTP が有効になっている場合には、出力は次のようになります。

    Publish Via HTTP:   yes
    Published At:       http://satellite.example.com/pulp/isos/uuid/

    HTTP が有効になっていない場合には、出力は次のようになります。

    Publish Via HTTP:   no
    Published At:       https://satellite.example.com/pulp/isos/uuid/
  3. On the client, enter a command in the appropriate format for HTTP or HTTPS:

    For HTTP:

    # curl -O satellite.example.com/pulp/isos/uuid/my_file

    For HTTPS:

    # curl -O --cert ./Default\ Organization-key-cert.pem --cacert katello-server-ca.crt satellite.example.com/pulp/isos/uuid/my_file