Chapter 14. Managing custom file type content
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. You must download the files on clients over HTTP or HTTPS by 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 repository source. You can create an independent repository source in a directory on Satellite Server, 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 local source for a custom file type repository You can create a custom file type repository source, from a directory of files, on the base system where Satellite is installed using Pulp Manifest . You can then synchronize the files into a repository and manage the custom file type content like any other content type. 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.2, "Creating a remote source for a custom file type repository" . Procedure Ensure the Utils repository is enabled. Enable the satellite-utils module: Install the Pulp Manifest package: 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: Create a directory that you want to use as the file type repository, such as: Add the parent folder into allowed import paths: Add files to the directory or create a test file: Run the Pulp Manifest command to create the manifest: Verify the manifest was created: Now, you can import your local source as a custom file type repository. Use the file:// URL scheme and the name of the directory to specify an Upstream URL , such as file:///var/lib/pulp/ local_repos / my_file_repo . For more information, see Section 14.3, "Creating a custom file type repository" . If you update the contents of your directory, re-run Pulp Manifest and sync the repository in Satellite. For more information, see Section 4.7, "Synchronizing repositories" . 14.2. Creating a remote source for a custom file type repository You can create a custom file type repository source from a directory of files that is external to Satellite Server using Pulp Manifest . You can then synchronize the files into a repository on Satellite Server over HTTP or HTTPS and manage the custom file type content like any other content type. 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.1, "Creating a local source for a custom file type repository" . Prerequisites You have a server running Red Hat Enterprise Linux 8 registered to your Satellite or the Red Hat CDN. Your server has an entitlement to the Red Hat Enterprise Linux Server and Red Hat Satellite Utils repositories. You have installed an HTTP server. For more information about configuring a web server, see Setting up the Apache HTTP web server in Red Hat Enterprise Linux 8 Deploying different types of servers . Procedure On your server, enable the required repositories: Enable the satellite-utils module: Install the Pulp Manifest package: Create a directory that you want to use as the file type repository in the HTTP server's public folder: Add files to the directory or create a test file: Run the Pulp Manifest command to create the manifest: Verify the manifest was created: Now, you can import your remote source as a custom file type repository. Use the path to the directory to specify an Upstream URL , such as http://server.example.com/ my_file_repo . For more information, see Section 14.3, "Creating a custom file type repository" . If you update the contents of your directory, re-run Pulp Manifest and sync the repository in Satellite. For more information, see Section 4.7, "Synchronizing repositories" . 14.3. 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. If you do not enter an upstream URL, you can manually upload packages. For more information, see Section 14.4, "Uploading files to a custom file type repository" . Select Verify SSL to verify that the SSL certificates of the repository 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 4.12, "Mirroring policies overview" . Optional: In the HTTP Proxy Policy field, select an 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: Table 14.1. Optional parameters for the hammer product create command Option Description --gpg-key-id gpg_key_id GPG key numeric identifier --sync-plan-id sync_plan_id Sync plan numeric identifier --sync-plan sync_plan_name Sync plan name to search by Create a file type repository: Table 14.2. Optional parameters for the hammer repository create command Option Description --checksum-type sha_version Repository checksum (either sha256 , sha384 , or sha512 ) --download-policy policy_name Download policy for repositories (either immediate or on_demand ) --gpg-key-id gpg_key_id GPG key numeric identifier --gpg-key gpg_key_name Key name to search by --mirror-on-sync boolean Must this repo be mirrored from the source, and stale packages 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-password repository_password Password for the upstream repository user --upstream-username repository_username Upstream repository user, if required for authentication --url My_Repository_URL URL of the remote repository --verify-ssl-on-sync boolean Verify that the upstream SSL certificates of the remote repository are signed by a trusted CA? Set to true or false , yes or no , 1 or 0 . 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 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.3, "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 Importing the Katello Root CA Certificate in Administering Red Hat Satellite . An Organization Debug Certificate. For more information, see Creating an Organization Debug Certificate in Administering Red Hat Satellite . 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 Published At URL. On your client, download the file from Satellite Server: For HTTPS: For HTTP: CLI procedure List the file type repositories. Display the repository information. If Unprotected is enabled, the output is similar to this: If Unprotected is not enabled, the output is similar to this: On your client, download the file from Satellite Server: For HTTPS: For HTTP:
subscription-manager repos --enable=rhel-8-for-x86_64-appstream-rpms --enable=rhel-8-for-x86_64-baseos-rpms --enable=satellite-utils-6.16-for-rhel-8-x86_64-rpms dnf module enable satellite-utils satellite-maintain packages install pulp-manifest satellite-maintain packages unlock satellite-maintain packages install pulp-manifest satellite-maintain packages lock mkdir -p /var/lib/pulp/ local_repos / my_file_repo satellite-installer --foreman-proxy-content-pulpcore-additional-import-paths /var/lib/pulp/ local_repos touch /var/lib/pulp/ local_repos / my_file_repo / test.txt pulp-manifest /var/lib/pulp/ local_repos / my_file_repo ls /var/lib/pulp/ local_repos / my_file_repo PULP_MANIFEST test.txt subscription-manager repos --enable=rhel-8-for-x86_64-appstream-rpms --enable=rhel-8-for-x86_64-baseos-rpms --enable=satellite-utils-6.16-for-rhel-8-x86_64-rpms dnf module enable satellite-utils dnf install pulp-manifest mkdir /var/www/html/pub/ my_file_repo touch /var/www/html/pub/ my_file_repo / test.txt pulp-manifest /var/www/html/pub/ my_file_repo ls /var/www/html/pub/ my_file_repo PULP_MANIFEST test.txt hammer product create --description " My_Files " --name " My_File_Product " --organization " My_Organization " --sync-plan " My_Sync_Plan " hammer repository create --content-type "file" --name " My_Files " --organization " My_Organization " --product " My_File_Product " hammer repository upload-content --id repo_ID --organization " My_Organization " --path example_file curl --cacert ./_katello-server-ca.crt --cert ./_My_Organization_key-cert.pem --remote-name https:// satellite.example.com /pulp/content/ My_Organization_Label /Library/custom/ My_Product_Label / My_Repository_Label / My_File curl --remote-name http:// satellite.example.com /pulp/content/ My_Organization_Label /Library/custom/ My_Product_Label / My_Repository_Label / My_File hammer repository list --content-type file ---|------------|-------------------|--------------|---- ID | NAME | PRODUCT | CONTENT TYPE | URL ---|------------|-------------------|--------------|---- 7 | My_Files | My_File_Product | file | ---|------------|-------------------|--------------|---- hammer repository info --name " My_Files " --organization-id My_Organization_ID --product " My_File_Product " Publish Via HTTP: yes Published At: https:// satellite.example.com /pulp/content/ My_Organization_Label /Library/custom/ My_File_Product_Label / My_Files_Label / Publish Via HTTP: no Published At: https:// satellite.example.com /pulp/content/ My_Organization_Label /Library/custom/ My_File_Product_Label / My_Files_Label / curl --cacert ./_katello-server-ca.crt --cert ./_My_Organization_key-cert.pem --remote-name https:// satellite.example.com /pulp/content/ My_Organization_Label /Library/custom/ My_Product_Label / My_Repository_Label / My_File curl --remote-name http:// satellite.example.com /pulp/content/ My_Organization_Label /Library/custom/ My_Product_Label / My_Repository_Label / My_File