Chapter 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.
You can upload files to the repository and synchronize files from an upstream Satellite Server. When you add files to a custom file type repository, you can use the normal Satellite management functions such as adding a specific version to a Content View to provide version control and making the repository of files available on various Capsule Servers. Clients must download the files over HTTP or HTTPS using curl -O
.
You can create a file type repository in Satellite Server only in a custom product, but there is flexibility in how you create the file type repository. You can create an independent file type repository in a directory on the system where Satellite is installed, or on a remote HTTP server, and then synchronize the contents of that directory into Satellite. This method is useful when you have multiple files to add to a Satellite repository.
14.1. Creating a Custom File Type Repository
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.
To use the CLI instead of the Satellite web UI, see the CLI procedure.
Procedure
- In the Satellite web UI, navigate to Content > Products.
- Select a product that you want to create a repository for.
- On the Repositories tab, click New Repository.
- In the Name field, enter a name for the repository. Satellite automatically completes the Label field based on the name.
- Optional: In the Description field, enter a description for the repository.
-
From the Type list, select
file
as type of repository. - Optional: In the Upstream URL field, enter the URL of the upstream repository to use as a source.
- Select the Verify SSL checkbox if you want to verify that the upstream repository’s SSL certificates are signed by a trusted CA.
- Optional: In the Upstream Username field, enter the user name for the upstream repository if required for authentication. Clear this field if the repository does not require authentication.
- Optional: In the Upstream Password field, enter the corresponding password for the upstream repository. Clear this field if the repository does not require authentication.
- Optional: In the Upstream Authentication Token field, provide the token of the upstream repository user for authentication. Leave this field empty if the repository does not require authentication.
- From the Mirroring Policy list, select the type of content synchronization Satellite Server performs. For more information, see Section 6.10, “Mirroring Policies Overview”.
-
Optional: In the HTTP Proxy Policy field, select or deselect using a HTTP proxy. By default, it uses the
Global Default
HTTP proxy. - Optional: You can clear the Unprotected checkbox to require a subscription entitlement certificate for accessing this repository. By default, the repository is published through HTTP.
- Optional: In the SSL CA Cert field, select the SSL CA Certificate for the repository.
- Optional: In the SSL Client Cert field, select the SSL Client Certificate for the repository.
- Optional: In the SSL Client Key field, select the SSL Client Key for the repository.
- Click Save to create the repository.
CLI procedure
Create a custom product:
# hammer product create \ --description "My_Files" \ --name "My_File_Product" \ --organization "My_Organization" \ --sync-plan "My_Sync_Plan"
Table 14.1. Optional Parameters for the hammer product create Command Option Description --gpg-key-id
gpg_key_idGPG key numeric identifier
--sync-plan
sync_plan_nameSync plan name to search by
--sync-plan-id
sync_plan_idSync plan numeric identifier
Create a
file
type repository:# hammer repository create \ --content-type "file" \ --name "My_Files" \ --organization "My_Organization" \ --product "My_File_Product"
Table 14.2. Optional Parameters for the hammer repository create Command Option Description --checksum-type
sha_versionRepository checksum, currently 'sha1' & 'sha256' are supported
--download-policy
policy_nameDownload policy for yum repos (either 'immediate' or 'on_demand').
--gpg-key
gpg_key_nameKey name to search by
--gpg-key-id
gpg_key_idGPG key numeric identifier
--mirror-on-sync
booleanMust this repo be mirrored from the source, and stale RPMs removed, when synced? Set to
true
orfalse
,yes
orno
,1
or0
.--publish-via-http
booleanMust this also be published using HTTP? Set to
true
orfalse
,yes
orno
,1
or0
.--upstream-username
repository_usernameUpstream repository user, if required for authentication
--upstream-password
repository_passwordPassword for the upstream repository user
--url
source_repo_urlURL of the Source repository
--verify-ssl-on-sync
booleanMust Katello verify that the upstream URL’s SSL certificates are signed by a trusted CA? Set to
true
orfalse
,yes
orno
,1
or0
.
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.
Use this procedure to configure a repository in a directory on the base system where Satellite is installed. To create a file type repository in a directory on a remote server, see Section 14.3, “Creating a Remote File Type Repository”.
Procedure
To create a file type repository in a local directory, complete the following procedure:
Ensure the Utils repository is enabled.
# subscription-manager repos --enable=rhel-8-for-x86_64-baseos-rpms \ --enable=rhel-8-for-x86_64-appstream-rpms \ --enable=satellite-utils-6.11-for-rhel-8-x86_64-rpms
Install the Pulp Manifest package:
# satellite-maintain packages install python38-pulp_manifest
Note that this command stops the Satellite service and re-runs satellite-installer. Alternatively, to prevent downtime caused by stopping the service, you can use the following:
# satellite-maintain packages unlock # yum install python38-pulp_manifest # satellite-maintain packages lock
Create a directory that you want to use as the file type repository in the HTTP server’s public folder, for example,
/var/lib/pulp/sync_imports/new_repo
# mkdir
/var/lib/pulp/sync_imports/new_repo
Add files to the directory or create a test file:
# touch my_file_repo/test.txt
Enter the Pulp Manifest command to create the manifest:
# pulp-manifest my_file_repo
Verify the manifest was created:
# ls my_file_repo PULP_MANIFEST test.txt
Configure additional import paths to sync a file repository that exists on the Satellite. For example, if a file repository is at
/path/to/myrepo
, enter:# satellite-installer --foreman-proxy-content-pulpcore-additional-import-paths /path/to/myrepo
Importing Files from a File Type Repository
To import files from a file type repository in a local directory, complete the following procedure:
- Ensure a custom product exists in Satellite Server.
- In the Satellite web UI, navigate to Content > Products.
- Select the name of a product.
- Click the Repositories tab and select New Repository.
- In the Name field, enter a name for the repository. Satellite automatically completes this field based on what you enter for Name.
- From the Type list, select the content type of the repository.
-
In the Upstream URL field, enter the local directory with the repository to use as the source, in the form
file:///my_file_repo
. - Select the Verify SSL checkbox to check the SSL certificate for the repository or clear the Verify SSL checkbox.
- Optional: In the Upstream Username field, enter the upstream user name that you require.
- Optional: In the Upstream Password field, enter the corresponding password for your upstream user name.
- Optional: In the Upstream Authentication Token field, provide the token of the upstream repository user for authentication. Leave this field empty if the repository does not require authentication.
- From the Mirroring Policy list, select the type of content synchronization Satellite Server performs. For more information, see Section 6.10, “Mirroring Policies Overview”.
-
Optional: In the HTTP Proxy Policy field, select the desired HTTP proxy. The default value is
Global Default
. - Optional: You can clear the Unprotected checkbox to require a subscription entitlement certificate for accessing this repository. By default, the repository is published through HTTP.
- Optional: In the GPG Key field, select the GPG key for the repository.
- Optional: In the SSL CA Cert field, select the SSL CA Certificate for the repository.
- Optional: In the SSL Client cert field, select the SSL Client Certificate for the repository.
- Optional: In the SSL Client Key field, select the SSL Client Key for the repository.
- Select Save to save this repository entry.
Updating a File Type Repository
To update the file type repository, complete the following steps:
- In the Satellite web UI, navigate to Content > Products.
- Select the name of a product.
- Select the name of the repository you want to update.
- From the Select Action menu, select Sync Now.
- 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.
Use this procedure to configure a repository in a directory on a remote server. To create a file type repository in a directory on the base system where Satellite Server is installed, see Section 14.2, “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 Client 6 repositories.
- You have installed an HTTP server. For more information about configuring a web server, see The Apache HTTP Server in the Red Hat Enterprise Linux 7 System Administrator’s Guide.
Procedure
To create a file type repository in a remote directory, complete the following procedure:
On your machine, ensure that the correct repositories are enabled.
For Red Hat Enterprise Linux 8:
# subscription-manager repos --enable=rhel-8-for-x86_64-baseos-rpms \ --enable=rhel-8-for-x86_64-appstream-rpms \ --enable=satellite-utils-6.11-for-rhel-8-x86_64-rpms
For Red Hat Enterprise Linux 7:
# subscription-manager repos --enable=rhel-7-server-rpms \ --enable=rhel-7-server-satellite-utils-6.11-rpms
Install the Pulp Manifest package:
For Red Hat Enterprise Linux 8:
# yum install python38-pulp_manifest
For Red Hat Enterprise Linux 7:
# yum install tfm-pulpcore-python3-pulp_manifest
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
Add files to the directory or create a test file:
# touch /var/www/html/pub/my_file_repo/test.txt
Enter the Pulp Manifest command to create the manifest:
# pulp-manifest /var/www/html/pub/my_file_repo
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:
- Ensure a custom product exists in Satellite Server, or create a custom product. For more information see Section 14.1, “Creating a Custom File Type Repository”
- In the Satellite web UI, navigate to Content > Products.
- Select the name of a product.
- Click the Repositories tab and select New Repository.
- In the Name field, enter a name for the repository. Red Hat Satellite automatically completes this field based on what you enter for Name.
- From the Type list, select file.
- In the Upstream URL field, enter the URL of the upstream repository to use as a source.
- Select the Verify SSL checkbox if you want to verify that the upstream repository’s SSL certificates are signed by a trusted CA.
- Optional: In the Upstream Username field, enter the user name for the upstream repository if required for authentication. Clear this field if the repository does not require authentication.
- Optional: In the Upstream Password field, enter the corresponding password for the upstream repository. Clear this field if the repository does not require authentication.
- Optional: In the Upstream Authentication Token field, provide the token of the upstream repository user for authentication. Leave this field empty if the repository does not require authentication.
- From the Mirroring Policy list, select the type of content synchronization Satellite Server performs. For more information, see Section 6.10, “Mirroring Policies Overview”.
-
Optional: In the HTTP Proxy Policy field, select the desired HTTP proxy. The default value is
Global Default
. - Optional: You can clear the Unprotected checkbox to require a subscription entitlement certificate for accessing this repository. By default, the repository is published through HTTP.
- Optional: In the GPG Key field, select the GPG key for the repository.
- Optional: In the SSL CA Cert field, select the SSL CA Certificate for the repository.
- Optional: In the SSL Client cert field, select the SSL Client Certificate for the repository.
- Optional: In the SSL Client Key field, select the SSL Client Key for the repository.
- Click Save.
- To update the file type repository, navigate to Content > Products. Select the name of a product that contains the repository that you want to update.
- In the product’s window, select the name of the repository you want to update.
- 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
Use this procedure to upload files to a custom file type repository.
Procedure
- In the Satellite web UI, navigate to Content > Products.
- Select a custom product by name.
- Select a file type repository by name.
- Click Browse to search and select the file you want to upload.
- Click Upload to upload the selected file to Satellite Server.
- Visit the URL where the repository is published to see the file.
CLI procedure
# hammer repository upload-content \ --id repo_ID \ --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
You can download files to a client over HTTPS using curl -O
, and optionally over HTTP if the Unprotected option for repositories is selected.
Prerequisites
- You have a custom file type repository. For more information, see Section 14.1, “Creating a Custom File Type Repository”.
- You know the name of the file you want to download to clients from the file type repository.
To use HTTPS you require the following certificates on the client:
-
The
katello-server-ca.crt
. For more information, see Installing the Katello Root CA Certificate in the Administering Red Hat Satellite guide. - An Organization Debug Certificate. For more information, see Section 3.3, “Creating an Organization Debug Certificate”.
-
The
Procedure
- In the Satellite web UI, navigate to Content > Products.
- Select a custom product by name.
- Select a file type repository by name.
- Ensure to select the Unprotected checkbox to access the repository published through HTTP.
- Copy the URL where the repository is published.
CLI procedure
List the file type repositories.
# hammer repository list --content-type file ---|------------|-------------------|--------------|---- ID | NAME | PRODUCT | CONTENT TYPE | URL ---|------------|-------------------|--------------|---- 7 | My_Files | My_File_Product | file | ---|------------|-------------------|--------------|----
Display the repository information.
# hammer repository info \ --name "My_Files" \ --organization-id My_Organization_ID \ --product "My_File_Product"
If Unprotected is enabled, the output is similar to this:
Publish Via HTTP: yes Published At: https://satellite.example.com/pulp/content/My_Organization_Label/Library/custom/My_File_Product_Label/My_Files_Label/
If Unprotected is not enabled, the output is similar to this:
Publish Via HTTP: no Published At: https://satellite.example.com/pulp/content/My_Organization_Label/Library/custom/My_File_Product_Label/My_Files_Label/
On the client, enter a command in the appropriate format for HTTP or HTTPS:
For HTTP:
# curl -O http://satellite.example.com/pulp/content/My_Organization_Label/Library/custom/My_File_Product_Label/My_Files_Label/my_file
For HTTPS:
# curl -O --cert ./_My-Organization-key-cert.pem_ --cacert katello-server-ca.crt https://satellite.example.com/pulp/content/My_Organization_Label/Library/custom/My_File_Product_Label/My_Files_Label/my_file