Chapter 5. Importing Custom Content


The previous chapter examined how to import Red Hat content into the Definitive Media Library (DML). This chapter focuses on custom content, which differs slightly from Red Hat content. We create our own product beforehand, customize it, and add our own repositories. In addition, you can add Puppet modules to a custom repository.

5.1. Using Custom Products in Satellite

In Section 4.2, “Using Products and Repositories in Satellite”, we explored the concept of a Product in Red Hat Satellite 6 and how it is used to group repositories together. Red Hat Satellite 6 also provides the ability to create custom Products so you can add multiple related repositories. Both Red Hat content and custom content in Red Hat Satellite 6 share some similarities:

  • The relationship between a product and its repositories is the same and the repositories still require synchronization.
  • Custom Products require a subscription for clients to access, similar to subscriptions to Red Hat Products. Red Hat Satellite 6 creates a new subscription for each custom Product you create.

In this chapter, we aim to create a product that contains two related repositories: an RPM repository containing RPM content and a Puppet repository for modules to configure the RPM content.

5.2. Creating a Custom Product

In our scenario, ACME is aiming to develop a product called Exampleware, which is a web-based application that requires a PostgreSQL database. ACME might aim to use production-level Exampleware in the field using PostgreSQL from the Red Hat Enterprise Linux repositories but test Exampleware with newer versions of PostgreSQL. For this situation, let’s create a custom product for PostgreSQL so that we can synchronize the newer versions.

For Web UI Users

Navigate to Content > Products and click New Product. A form for a new Product appears. Enter the following details:

  • Name - The plain text name for the product. Enter PostgreSQL.
  • Label - An internal ID for the product. Red Hat Satellite 6 automatically completes this field based on what you have entered for Name.
  • GPG Key - The GPG Key for the entire product. Leave this blank as we will import a GPG for a specific version of PostgreSQL and attach it to the repository instead of the product.
  • Sync Plan - A synchronization plan for the product. We can attach this to the Example Plan we created in the previous chapter.
  • Description - A plain text description of the product. Enter Content from PostgreSQL repositories.

When you have entered this information, click Save.

For CLI Users

Create the product with one command:

# hammer product create \
--name "PostgreSQL" \
--sync-plan "Example Plan" \
--description "Content from PostgreSQL repositories" \
--organization "ACME"

This creates a new product where we can create our own custom repositories and synchronize their content.

5.3. Importing a Custom GPG Key

Before we create a custom product, we might need to create a custom GPG key. This is used to provide a certain level of security for RPM transactions with the PostgreSQL repository.

First download a copy of the version specific repository package to your client system. In our case, we download pgdg-redhat95:

[user@client ~]$ wget http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-redhat95-9.5-2.noarch.rpm

Extract the RPM file without installing it:

[user@client ~]$ rpm2cpio pgdg-redhat95-9.5-2.noarch.rpm | cpio -idmv

The GPG key is located relative to the extraction at etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-95.

For Web UI Users

Navigate to Content > GPG keys. Click New Gpg Key. Provide the GPG key with a name (PostgreSQL 9.5) and select Upload GPG Key. Click Browse and select the GPG key you extracted. Click Save.

For CLI Users

Copy the GPG key to your Satellite Server:

[user@client ~]$ scp ~/etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-95 root@satellite.example.com:~/.

Upload the GPG key to Satellite:

[root@satellite ~]# hammer gpg create \
--key ~/RPM-GPG-KEY-PGDG-95 \
--name "PostgreSQL 9.5" \
--organization "ACME"

Now we have a GPG key we can associate with our repository.

5.4. Creating a Custom RPM Repository

Normally, a production-level server would use the version of PostgreSQL included with Red Hat Enterprise Linux for stability purposes. However, ACME’s developers might aim to test Exampleware with a more recent version of PostgreSQL. In this instance, they can create a custom repository for a newer version of PostgreSQL.

For Web UI Users

We follow on from creating our custom PostgreSQL product. After creating our custom product, the repositories screen appears. Click Create Repository, which displays a form for a new repository. Enter the following details:

  • Name - A plain text name for the repository. Enter PostgreSQL 9.5.
  • Label - An internal ID for the repository. Red Hat Satellite 6 automatically completes this field based on what you have entered for Name.
  • Type - The type of repository. You can choose either a repository for RPM files (yum), Puppet modules (puppet), or Docker images (docker). For our scenario, select yum. A new set of fields appear.
  • URL - The URL of the external repository to use as a source. Enter http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/.
  • Download Policy - Determines the type of synchronization the Satellite Server performs. Select Immediate. See Section 4.4, “Using Download Policies” for more information.
  • Mirror on Sync - Ensures the content that is no longer part of the upstream repository is removed during synchronization. Leave this checked, which is the default.
  • Checksum - The checksum for the repository. For this example, leave this as the Default, which defaults to SHA256. This is the checksum required for Red Hat Enterprise Linux 7. For Red Hat Enterprise Linux 5 or previous versions, select SHA1 for the checksum.
  • Publish via HTTP - Enables this repository for publication through HTTP. This option is automatically selected.
  • GPG Key - The GPG Key for this repository. Select the PostgreSQL 9.5 GPG key we created previously.

Click Save to save this repository entry.

The repository uses the synchronization plan to periodically keep it up to date. However, let’s perform an initial synchronization. Select the PostgreSQL 9.5 repository and click Sync Now. This starts a task to synchronize our repository with the external PostgreSQL repository.

Note

Monitor the progress of this synchronization on the Content > Sync Status page.

For CLI Users

Run the following command to create the repository:

# hammer repository create \
--name "PostgreSQL 9.5" \
--content-type "yum" \
--publish-via-http true \
--url http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/ \
--gpg-key "PostgreSQL 9.5" \
--product "PostgreSQL" \
--organization "ACME"

Then synchronize the repository:

# hammer repository synchronize \
--name "PostgreSQL 9.5" \
--product "PostgreSQL" \
--organization "ACME"

Now we have a synchronized copy of PostgreSQL 9.5. Let’s take this a step further and include a Puppet module to configure a PostgreSQL server.

Note

The Products page in the Web UI also provides a Repo Discovery function that finds all repositories from a URL and allows you to select which ones to add to your custom Product. For example, you can use the Repo Discovery to search http://yum.postgresql.org/9.5/redhat/ and list all PostgreSQL 9.5 repositories for different Red Hat Enterprise Linux versions and architectures. This helps users save time importing multiple repositories from a single source.

Important

Red Hat does not support the upstream RPMs directly from the PostgreSQL site. These RPMs are used to demonstrate the synchronization process. For any issues with these RPMs, contact the developers for PostgreSQL.

5.5. Creating a Custom Puppet Repository

Custom products can also include repositories for Puppet modules. This provides a method to incorporate state configuration of hosts.

First, let’s create a repository for our PostgreSQL product.

For Web UI Users

Make sure you are on the Product page (Content > Products). Click on the PostgreSQL product, which displays our repository listing. Click Create Repository, which displays a form for a new repository. Enter the following details:

  • Name - A plain text name for the repository. Enter PostgreSQL Puppet Modules.
  • Label - An internal ID for the repository. Red Hat Satellite 6 automatically completes this field based on what you have entered for Name.
  • Type - The type of repository. Select puppet and a URL field appears.
  • URL - The URL of the external repository to use as a source. We will manually import our Puppet module, but you can use a repository source to synchronize your own Puppet modules.

Click Save to save this repository entry.

For CLI Users

Use the following command to create our Puppet module repository:

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

Now we have a custom repository for our Puppet modules. Let’s add one now.

5.6. Managing Individual Puppet Modules

For this scenario, we manually import a Puppet module for configuring PostgreSQL.

Download this module from the Puppet Forge site (https://forge.puppetlabs.com/puppetlabs/postgresql). Open the page in your browser and click download latest tar.gz to save to your local file system.

For Web UI Users

Make sure you are on the repository listing page for the PostgreSQL product. Click on the PostgreSQL Puppet Modules repository, which displays the details page for that repository.

Scroll to the Upload Puppet Module section, click Browse, select the PostgreSQL Puppet Module we downloaded previously, and click Upload. After a few seconds, the Satellite Server reports Content successfully uploaded.

Note

Click on the Manage Puppet Modules page to manage and remove Puppet modules from a product.

For CLI Users

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

[user@client ~]$ scp ~/<puppet_module>.tar.gz root@satellite.example.com:~/.

Import the Puppet module to the PostgreSQL Puppet Modules repository:

[root@satellite ~]# hammer repository upload-content \
--path ~/<puppet_module>.tar.gz \
--name "PostgreSQL Puppet Modules" \
--product "PostgreSQL" \
--organization "ACME"

Now we have a custom repository that contains both RPM content and a Puppet module to install and configure a server using the RPM content.

Important

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

5.7. Synchronizing Puppet Repositories

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

For Web UI Users

Navigate to Content > Products and click New Product. A form for a new Product appears. Enter the following details:

  • Name - The plain text name for the product. Enter Puppet Forge.
  • Label - An internal ID for the product. Red Hat Satellite 6 automatically completes this field based on what you have entered for Name.
  • GPG Key - The GPG Key for the entire product. Leave this blank.
  • Sync Plan - A synchronization plan for the product. We can attach this to the Example Plan we created in the previous chapter.
  • Description - A plain text description of the product. Enter All modules from Puppet Forge.

When you have entered this information, click Save.

After creating our custom product, the repositories screen appears. Click Create Repository, which displays a form for a new repository. Enter the following details:

  • Name - A plain text name for the repository. Enter Puppet Forge Modules.
  • Label - An internal ID for the repository. Red Hat Satellite 6 automatically completes this field based on what you have entered for Name.
  • Type - The type of repository. Select puppet and a URL field appears.
  • URL - The URL of the external repository to use as a source. Enter http://forge.puppetlabs.com/.

Click Save to save this repository entry.

Select the Puppet Forge Modules repository and click Sync Now. This imports all modules from Puppet Forge into the Satellite Server.

For CLI Users

Create the product:

# hammer product create \
--name "Puppet Forge" \
--sync-plan "Example Plan" \
--description "All modules from Puppet Forge" \
--organization "ACME"

Create the Puppet Forge repository:

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

Synchronize the repository:

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

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

Important

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.

5.8. 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 the 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

This checks out the develop branch of the Git repository from git@mygitserver.com:mymodules.git and publishes it to /modules. Add this directory as the URL (file:///modules) for a new repository on the Satellite Server. For example:

For Web UI Users

Open a custom product (in this case, we will use MyProduct as an example) and click Create Repository. Enter the following details:

  • Name - A plain text name for the repository. Enter Modules from Git.
  • Label - An internal ID for the repository. Red Hat Satellite 6 automatically completes this field based on what you have entered for Name.
  • Type - The type of repository. Select puppet and a URL field appears.
  • URL - The URL of the external repository to use as a source. Enter file:///modules.

For CLI Users

Create the Puppet Forge repository:

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

The same process also applies to publishing modules on a remote HTTP server. For example, if you use webserver.example.com as a standard web host to publish the Puppet modules, log into the host and run the following commands:

# 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 the Satellite Server, set the repository’s URL to http://webserver.example.com/modules/.

5.9. Chapter Summary

This chapter demonstrated how to create custom repositories for non-Red Hat content. This includes RPM files and Puppet modules.

At this point we have all our base content imported into our Satellite Server’s DML. This means we can start using it in our application life cycle.

The next chapter looks at developing an application life cycle to match the development and production process of ACME.

Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.