第15章 Managing Custom Puppet Content

Satellite で、Puppet モジュールを使用してホストの状態設定を組み込む場合は、Puppet モジュールが状態設定を組み込むのに使用するリポジトリーで、カスタム製品を作成します。

15.1. Creating a Custom Puppet Repository

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

Procedure

  1. Satellite Web UI で、コンテンツ > 製品 に移動し、使用する製品をクリックします。
  2. Click Create Repository.
  3. 名前 フィールドで、リポジトリーの名前を入力します。Red Hat Satellite 6 では、名前 に入力した内容に基づいて ラベル フィールドに値が自動的に入力されます。
  4. タイプ の一覧から puppet を選択します。
  5. In the URL field, enter the URL of the external repository to use as a source. You can use a repository source to synchronize your own Puppet modules.
  6. 保存をクリックします。

For CLI Users

  1. Enter the following command to create a Puppet module repository:

    # hammer repository create \
    --name "PostgreSQL Puppet Modules" \
    --content-type "puppet" \
    --product "PostgreSQL" \
    --organization "My_Organization"

15.2. Managing Individual Puppet Modules

RPM コンテンツと Puppet モジュールの両方が含まれるカスタム製品を作成して、カスタム RPM コンテンツを使用するサーバーをインストールして設定する場合には、「Creating a Custom Puppet Repository」の手順を使用してから、以下の手順に従い、Puppet モジュールをアップロードします。

カスタム RPM のサポート

Red Hat does not support the modules from Puppet Forge. For any issues with these modules, contact the module developer.

Prerequisites

  1. From the Puppet Forge website, download the module that you want to use, for example, https://forge.puppetlabs.com/puppetlabs/postgresql.
  2. In your web browser, click download latest tar.gz to save to your local file system.

Procedure

  1. Satellite Web UI で、コンテンツ > 製品 に移動し、管理する Puppet リポジトリーが含まれる製品を選択します。
  2. In the repository window, click the new Puppet repository, which displays the details page for that repository.
  3. Puppet モジュールのアップロード エリアに移動し、参照 をクリックします。新たにダウンロードして抽出された Puppet モジュールを選択し、アップロード をクリックします。

To manage and remove Puppet modules from a product, complete the following steps:

  1. In the window for your Puppet Modules repository, navigate to the upper right of the window to the Content Counts area. In the Puppet Modules row, click the numerical value that is displayed for the Puppet Modules.
  2. Puppet モジュールリポジトリーウィンドウの Puppet モジュールの管理 で、管理するモジュールを選択して、アクションの選択 をクリックし、アクションを実行するか、Puppet モジュールの削除 を選択します。

For CLI Users

  1. Copy the Puppet module to your Satellite Server’s file system:

    $ scp ~/puppet_module.tar.gz root@satellite.example.com:~/.
  2. Import the Puppet module to the Puppet Modules repository:

    # hammer repository upload-content \
    --path ~/puppet_module.tar.gz \
    --name "My Puppet Modules" \
    --organization "My_Organization"

15.3. Synchronizing Puppet Repositories

In addition to creating a repository of uploaded Puppet modules, Satellite Server can synchronize a complete Puppet module repository. In this example, Satellite Server synchronizes the entire Puppet Forge repository.

カスタム RPM のサポート

Red Hat does not support the modules from Puppet Forge. The modules are used to demonstrate the synchronization process. For any issues with these modules, contact the module developer.

Procedure

  1. In the Satellite web UI, navigate to Content > Products and click New Product.
  2. 名前 フィールドで、製品の名前を入力します。Red Hat Satellite 6 では、名前 に入力した内容に基づいて ラベル フィールドに自動的に入力されます。
  3. オプション: GPG キー の一覧から、製品の GPG キーを選択します。
  4. オプション: 同期プラン リストから製品の同期プランを選択します。
  5. 説明フィールドには、製品の説明を入力します。
  6. 保存をクリックします。
  7. Click Create Repository, which displays a form for a new repository.
  8. 名前 フィールドに、リポジトリーの名前を入力します。Red Hat Satellite 6 では、名前 に入力した名前をもとに、このフィールドに値が自動的に入力されます。
  9. タイプ の一覧から puppet を選択します。
  10. In the URL field, enter http://forge.puppetlabs.com/.
  11. Click Save
  12. 新しい Puppet リポジトリーを選択し、今すぐ同期 をクリックして、Puppet Forge から Satellite Server に全モジュールをインポートします。この処理には時間がかかることがあります。

For CLI Users

  1. Create the product:

    # hammer product create \
    --name "Puppet Forge" \
    --sync-plan "Example Plan" \
    --description "All modules from Puppet Forge" \
    --organization "My_Organization"
  2. Create the Puppet Forge repository:

    # hammer repository create \
    --name "Puppet Forge Modules" \
    --content-type "puppet" \
    --product "Puppet Forge" \
    --organization "My_Organization" \
    --url http://forge.puppetlabs.com/
  3. Synchronize the repository:

    # hammer repository synchronize \
    --name "Puppet Forge Modules" \
    --product "Puppet Forge" \
    --organization "My_Organization"

The Puppet Forge repository contains several thousand modules and can take a long time to synchronize.

15.4. Synchronizing Puppet Modules from a Git Repository

Red Hat Satellite 6 includes a utility called pulp-puppet-module-builder, which you can install on other systems from the pulp-puppet-tools RPM. This tool checks out a Git repository, builds all the modules, and publishes them in a structure that Satellite 6 can synchronize. One common method is to run the utility on Satellite Server itself, publish to a local directory, and synchronize against that directory. For example:

# mkdir /modules
# chmod 755 /modules
# pulp-puppet-module-builder \
--output-dir=/modules \
--url=git@mygitserver.com:mymodules.git \
--branch=develop

この例では、Git リポジトリーの develop ブランチを git@mygitserver.com:mymodules.git からチェックアウトし、/modules に公開します。このディレクトリーを Satellite Server の新規リポジトリーの URL (file:///modules) として追加します。

Publishing Puppet Modules on a Remote HTTP Server

リモートの HTTP サーバー上にモジュールを公開する場合でも同じプロセスを実行します。たとえば、Puppet モジュールを公開する標準 Web ホストとして webserver.example.com を使用します。

# mkdir /var/www/html/modules/
# chmod 755 /var/www/html/modules/
# pulp-puppet-module-builder \
--output-dir=/var/www/html/modules/ \
--url=git@mygitserver.com:mymodules.git \
--branch=develop

On Satellite Server, set the repository’s URL to http://webserver.example.com/modules/.

Synchronizing Puppet Modules from a Git repository using the web UI

Use the following procedure to synchronize Puppet modules from a Git repository.

Procedure

  1. カスタム製品を作成し、リポジトリーの作成 をクリックします。
  2. タイプ の一覧から puppet を選択します。
  3. In the URL field, enter the URL of the external Git repository to use as a source in the following format: file:///modules.

For CLI Users

  1. Create the Puppet Forge repository:

    # hammer repository create \
    --name "Modules from Git" \
    --content-type "puppet" \
    --product "MyProduct" \
    --organization "My_Organization" \
    --url file:///modules