Bookmark this page

Export and Import Content Views

Objectives

  • Transfer content between Satellite Servers by using defined content view versions or individual repositories.

Export and Import Use Cases

You can export and import content with a Satellite Server for many use cases. The following cases are examples where export and import are required:

  • Your organization has more than one Satellite Server, and one or more might not have internet access. Updated content is exported from the connected Satellite to import to the disconnected one.

  • Your organization has a central Satellite Server to host all content, and uses only content subsets on other Satellite Servers.

  • Your organization has a staging Satellite host to test upgrades to Satellite before upgrading the production Satellite Server.

  • You test content views against representative systems, before duplicating the content views to other organizations on the same Satellite Server.

Export Content Views

As a Satellite administrator, you might export the repositories to synchronize content from one upstream server to one or more downstream servers.

Verify that prerequisites are satisfied before exporting a content view. The following list specifies the settings for each repository that is included in the content view:

  • The /var/lib/pulp/exports directory must have enough storage space.

  • The download policy must be set to immediate.

  • The repository must be synchronized up to the required date.

You can use different export options:

Export the Library Environment

This option syncs the whole Library rather than Content View versions to an archive file from Satellite Server. The archive file is used to create the same repositories in another Satellite Server or another Satellite Server organization. You can manage the versions downstream. Docker content is excluded from the archive file. The export process creates a new Content View named Export-Library in the organization.

When you export the Library, Satellite Server considers the following items:

  • RPMs that are included in a Content View version.

  • Kickstart files that are included in a Content View version.

To export the Library environment, use the following command:

[root@satellite ~]# hammer content-export complete library \
--organization myorg
[....................................................................] [100%]
Generated /var/lib/pulp/exports/myorg/Export-Library/1.0/2022-08-09T20-30-13-04-00/metadata.json

The exported archive file includes two files:

  • A JSON file that contains Content View version metadata.

  • An archive file that contains all the repositories from the Library environment of the organization.

Export a Content View Version

This option syncs only Content View versions to an archive file from Satellite Server. You organize updates from the CDN into Content Views and Lifecycle Environments to export the content. The archive file is used to create the same Content View version in another Satellite Server or another Satellite Server organization. Satellite exports Composite Content Views as normal Content Views, and its properties are not retained. Docker content and Content View definitions and metadata, such as package filters, are excluded from the archive file.

When you export a Content View, Satellite Server considers the following items:

  • RPMs that are added to a version of a Content View.

  • Kickstart files that are added to a version of a Content View.

To export a Content View version, use the following process:

Determine the ID of the content view version to export:

[root@satellite ~]# hammer --output base \
content-view version list \
--organization myorg
Id:                     3
Name:                   Demo 1.0
Version:                1.0
Description:
Lifecycle Environments: Library, Dev

Id:                     2
Name:                   Default Organization View 1.0
Version:                1.0
Description:
Lifecycle Environments: Library

You might export the Content View after you get the intended Content View version.

[root@satellite ~]# hammer content-export complete version \
--content-view Demo \
--id 3 \
--organization myorg
[....................................................................] [100%]
Generated /var/lib/pulp/exports/myorg/Demo/1.0/2022-08-09T17-59-43-04-00/metadata.json

The exported archive file includes two files:

  • A JSON file that contains Content View version metadata.

  • An archive file that contains all the repositories that are included in the Content View version.

Export a Repository

This option syncs a single repository to an archive file from Satellite Server. The archive file is used to create the same repository in another Satellite Server or in another Satellite Server organization. Docker content is excluded from the archive file.

When you export a repository, Satellite Server considers the following items: Satellite Server exports:

  • RPM repositories

  • Kickstart repositories

  • Ansible repositories

  • File repositories

To export a repository, use the following command:

[root@satellite ~]# hammer content-export complete repository \
--organization myorg \
--product 'Red Hat Enterprise Linux for x86_64' \
--name 'Red Hat Enterprise Linux 9 for x86_64 - BaseOS RPMs 9'
[....................................................................] [100%]
Generated /var/lib/pulp/exports/myorg/Export-Red_Hat_Enterprise_Linux_9_for_x86_64_-_BaseOS_RPMs_9-48/1.0/2022-08-09T20-27-44-04-00/metadata.json

The exported archive file includes two files:

  • A JSON file that contains Content View version metadata.

  • One or more archive files that contain the contents of the repository from the Library environment of the organization.

Layout of the Export Archive

The archive file that is generated by the export process contains the following files:

  • The export-id-timestamp-toc.json file is in JSON format. It contains the chunk size, the file names, and its SHA256 checksum.

  • The metadata.json file is in JSON format. It contains all the metadata for the export archive.

  • The export-id-timestamp.tar.gz file is an archive. It contains all the packages and repository metadata that are exported from Pulp.

[root@satellite ~]# ls -goh \
/var/lib/pulp/exports/myorg/Export-Library/1.0/2022-08-09T20-30-13-04-00/
total 1.3G
-rw-r--r--. 1 1.3G Aug  9 20:31 export-d640765d-ac45-462e-b6fb-b308cfa4e8ad-20220810_0030.tar.gz
-rw-r--r--. 1  333 Aug  9 20:31 export-d640765d-ac45-462e-b6fb-b308cfa4e8ad-20220810_0030-toc.json
-rw-r--r--. 1 1.1K Aug  9 20:31 metadata.json

Import Content Views

Verify that the prerequisites are satisfied before exporting a content view.

  • The exported files must be in a directory under /var/lib/pulp/imports.

  • The import directory and its contents must be owned by the pulp:pulp user and group.

  • If the exported content includes a Red Hat repository, then the importing organization's manifest must contain subscriptions to the products that are included in the export.

  • Users who import content must have the Content Importer role.

You can use different import options:

Import the Library Environment

You can import an instance of Library content into the Library lifecycle environment of an organization on another Satellite Server. The import process creates a Content View named Import-Library in the target organization.

To import the Library environment, use the following command:

Note

You must enter the full path /var/lib/pulp/imports/Exported_Dir

[root@satellite ~]# hammer content-import library \
--organization myotherorg \
--path /var/lib/pulp/imports/2022-08-09T20-30-13-04-00
[....................................................................] [100%]

Import a Content View Version

You might import an exported Content View version to create a version with the same content in an organization on another Satellite Server.

To import a Content View version, use the following command:

Note

You must enter the full path /var/lib/pulp/imports/Exported_Dir

[root@satellite ~]# hammer content-import version \
--organization myotherorg \
--path /var/lib/pulp/imports/2022-08-09T17-59-43-04-00
[....................................................................] [100%]

Import a Repository

You might import an exported repository into an organization on another Satellite Server.

To import a repository, use the following command:

Note

You must enter the full path /var/lib/pulp/imports/Exported_Dir

[root@satellite ~]# hammer content-import repository \
> --organization myotherorg \
> --path /var/lib/pulp/imports/2022-08-09T20-27-44-04-00
[....................................................................] [100%]

References

For more information, see the Synchronizing Content between Satellite Servers chapter in the Managing Content guide at https://access.redhat.com/documentation/en-us/red_hat_satellite/6.11/html-single/managing_content/index#Synchronizing_Content_Between_Servers_content-management

Revision: rh403-6.11-3ad886e