Chapter 8. Managing Content Views
Red Hat Satellite uses Content Views to allow your hosts access to a deliberately curated subset of content. To do this, you must define which repositories to use and then apply certain filters to the content. These filters include package filters, package group filters, errata filters, module stream filters, and container image tag filters. You can use Content Views to define which software versions a particular environment uses. For example, a Production environment might use a Content View containing older package versions, while a Development environment might use a Content View containing newer package versions.
Alternatively, a Default Organization View is an application-controlled Content View for all content that is synchronized to Satellite. This type is useful if you want to register a host to Satellite and access content using a subscription, without manipulating content views and lifecycle environments.
Each Content View creates a set of repositories across each environment, which Satellite Server stores and manages. When you promote a Content View from one environment to the next environment in the application lifecycle, the respective repository on Satellite Server updates and publishes the packages.
Development | Testing | Production | |
---|---|---|---|
Content View Version and Contents | Version 2 – example_software-1.1-0.noarch.rpm | Version 1 – example_software-1.0-0.noarch.rpm | Version 1 – example_software-1.0-0.noarch.rpm |
The repositories for Testing and Production contain the example_software-1.0-0.noarch.rpm
package. If you promote Version 2 of the Content View from Development to Testing, the repository for Testing regenerates and then contains the example_software-1.1-0.noarch.rpm
package:
Development | Testing | Production | |
---|---|---|---|
Content View Version and Contents | Version 2 – example_software-1.1-0.noarch.rpm | Version 2 – example_software-1.1-0.noarch.rpm | Version 1 – example_software-1.0-0.noarch.rpm |
This ensures systems are designated to a specific environment but receive updates when that environment uses a new version of the Content View.
The general workflow for creating Content Views for filtering and creating snapshots is as follows:
- Create a Content View.
- Add one or more repositories that you want to the Content View.
- Optional: Create one or more filters to refine the content of the Content View. For more information, see Section 8.10, “Content Filter Examples”.
- Optional: Resolve any package dependencies for a Content View. For more information, see Section 8.8, “Resolving Package Dependencies”.
- Publish the Content View.
- Optional: Promote the Content View to another environment. For more information, see Section 8.4, “Promoting a Content View”.
- Attach the content host to the Content View.
If a repository is not associated with the Content View, the file /etc/yum.repos.d/redhat.repo
remains empty and systems registered to it cannot receive updates.
Hosts can only be associated with a single Content View. To associate a host with multiple Content Views, create a composite Content View. For more information, see Section 8.6, “Creating a Composite Content View”.
8.1. Creating a Content View
Use this procedure to create a simple Content View. To use the CLI instead of the Satellite web UI, see the CLI procedure.
Prerequisites
While you can stipulate whether you want to resolve any package dependencies on a Content View by Content View basis, you might want to change the default Satellite settings to enable or disable package resolution for all Content Views. For more information, see Section 8.8, “Resolving Package Dependencies”.
Procedure
- In the Satellite web UI, navigate to Content > Content Views and click Create content view.
- In the Name field, enter a name for the view. Satellite automatically completes the Label field from the name you enter.
- In the Description field, enter a description of the view.
- In the Type field, select a Content view or a Composite content view.
- Optional: If you want to solve dependencies automatically every time you publish this Content View, select the Solve dependencies checkbox. Dependency solving slows the publishing time and might ignore any Content View filters you use. This can also cause errors when resolving dependencies for errata.
- Optional: If you want to designate this Content View for importing from an upstream server, select the Import only checkbox. Import-only content views cannot be published directly.
- Click Create content view.
Content View Steps
- Click Create content view to create the Content View.
- In the Repositories tab, select the repository from the Type list that you want to add to your Content View, select the checkbox next to the available repositories you want to add, then click Add repositories.
- Click Publish new version and in the Description field, enter information about the version to log changes.
- Optional: You can enable a promotion path by clicking Promote to Select a lifecycle environment from the available promotion paths to promote new version.
- Click Next.
- On the Review page, you can review the environments you are trying to publish.
- Click Finish.
You can view the Content View in the Content Views window. To view more information about the Content View, click the Content View name. To register a host to your Content View, see Registering Hosts in Managing Hosts.
CLI procedure
Obtain a list of repository IDs:
# hammer repository list --organization "My_Organization"
Create the Content View and add repositories:
# hammer content-view create \ --description "My_Content_View" \ --name "My_Content_View" \ --organization "My_Organization" \ --repository-ids 1,2
For the
--repository-ids
option, you can find the IDs in the output of thehammer repository list
command.Publish the view:
# hammer content-view publish \ --description "My_Content_View" \ --name "My_Content_View" \ --organization "My_Organization"
Optional: To add a repository to an existing Content View, enter the following command:
# hammer content-view add-repository \ --name "My_Content_View" \ --organization "My_Organization" \ --repository-id repository_ID
Satellite Server creates the new version of the view and publishes it to the Library environment.
8.2. Copying a content view
You can copy a content view in the Satellite web UI or you can use the Hammer CLI to copy an existing content view into a new content view. To use the CLI instead of the Satellite web UI, see the CLI procedure.
A copied content view does not have the same history as the original content view. Version 1 of the copied content view begins at the last version of the original content view. As a result, you cannot promote an older version of a content view from the copied content view.
Procedure
- In the Satellite web UI, navigate to Content > Lifecycle > Content Views.
- Select the content view you want to copy.
- Click the vertical ellipsis icon and click Copy.
- In the Name field, enter a name for the new content view and click Copy content view.
Verification
- The copied content view appears on the Content views page.
CLI procedure
Copy the content view by using Hammer:
# hammer content-view copy --name My_original_CV_name \ --new-name My_new_CV_name
Verification
- The Hammer command reports:
# hammer content-view copy --id=5 --new-name="mixed_copy" Content view copied.
8.3. Viewing Module Streams
In Satellite, you can view the module streams of the repositories in your Content Views.
To use the CLI instead of the Satellite web UI, see the CLI procedure.
Procedure
- In the Satellite web UI, navigate to a published version of a Content View > Module Streams to view the module streams that are available for the Content Types.
- Use the Search field to search for specific modules.
- To view the information about the module, click the module and its corresponding tabs to include Details, Repositories, Profiles, and Artifacts.
CLI procedure
List all organizations:
# hammer organization list
View all module streams for your organization:
# hammer module-stream list \ --organization-id My_Organization_ID
8.4. Promoting a Content View
Use this procedure to promote Content Views across different lifecycle environments. To use the CLI instead of the Satellite web UI, see the CLI procedure.
Permission Requirements for Content View Promotion
Non-administrator users require two permissions to promote a Content View to an environment:
-
promote_or_remove_content_views
-
promote_or_remove_content_views_to_environment
.
The promote_or_remove_content_views
permission restricts which Content Views a user can promote.
The promote_or_remove_content_views_to_environment
permission restricts the environments to which a user can promote Content Views.
With these permissions you can assign users permissions to promote certain Content Views to certain environments, but not to other environments. For example, you can limit a user so that they are permitted to promote to test environments, but not to production environments.
You must assign both permissions to a user to allow them to promote Content Views.
Procedure
- In the Satellite web UI, navigate to Content > Content Views and select the Content View that you want to promote.
- Select the version that you want to promote, click the vertical ellipsis icon, and click Promote.
- Select the environment where you want to promote the Content View and click Promote.
Now the repository for the Content View appears in all environments.
CLI procedure
Promote the Content View using Hammer for each lifecycle environment:
# hammer content-view version promote \ --content-view "Database" \ --version 1 \ --to-lifecycle-environment "Development" \ --organization "My_Organization" # hammer content-view version promote \ --content-view "Database" \ --version 1 \ --to-lifecycle-environment "Testing" \ --organization "My_Organization" # hammer content-view version promote \ --content-view "Database" \ --version 1 \ --to-lifecycle-environment "Production" \ --organization "My_Organization"
Now the database content is available in all environments.
Alternatively, you can promote Content Views across all lifecycle environments within an organization using the following Bash script:
ORG="My_Organization" CVV_ID=My_Content_View_Version_ID for i in $(hammer --no-headers --csv lifecycle-environment list --organization $ORG | awk -F, {'print $1'} | sort -n) do hammer content-view version promote --organization $ORG --to-lifecycle-environment-id $i --id $CVV_ID done
Verification
Display information about your Content View version to verify that it is promoted to the required lifecycle environments:
# hammer content-view version info --id My_Content_View_Version_ID
Next steps
- To register a host to your Content View, see Registering Hosts in Managing Hosts.
8.5. Composite Content Views Overview
A Composite Content View combines the content from several Content Views. For example, you might have separate Content Views to manage an operating system and an application individually. You can use a Composite Content View to merge the contents of both Content Views into a new repository. The repositories for the original Content Views still exist but a new repository also exists for the combined content.
If you want to develop an application that supports different database servers. The example_application appears as:
example_software |
---|
Application |
Database |
Operating System |
Example of four separate Content Views:
- Red Hat Enterprise Linux (Operating System)
- PostgreSQL (Database)
- MariaDB (Database)
- example_software (Application)
From the previous Content Views, you can create two Composite Content Views.
Example Composite Content View for a PostgreSQL database:
Composite Content View 1 – example_software on PostgreSQL |
---|
example_software (Application) |
PostgreSQL (Database) |
Red Hat Enterprise Linux (Operating System) |
Example Composite Content View for a MariaDB:
Composite Content View 2 – example_software on MariaDB |
---|
example_software (Application) |
MariaDB (Database) |
Red Hat Enterprise Linux (Operating System) |
Each Content View is then managed and published separately. When you create a version of the application, you publish a new version of the Composite Content Views. You can also select the Auto Publish option when creating a Composite Content View, and then the Composite Content View is automatically republished when a Content View it includes is republished.
Repository restrictions
Docker repositories cannot be included more than once in a Composite Content View. For example, if you attempt to include two Content Views using the same docker repository in a Composite Content View, Satellite Server reports an error.
8.6. Creating a Composite Content View
Use this procedure to create a composite Content View. To use the CLI instead of the Satellite web UI, see the CLI procedure.
Procedure
- In the Satellite web UI, navigate to Content > Content Views and click Create content view.
- In the Create content view window, enter a name for the view in the Name field. Red Hat Satellite automatically completes the Label field from the name you enter.
- Optional: In the Description field, enter a description of the view.
- On the Type tab, select Composite content view.
- Optional: If you want to automatically publish a new version of the Composite Content View when a Content View is republished, select the Auto publish checkbox.
- Click Create content view.
- On the Content views tab, select the Content Views that you want to add to the Composite Content View, and then click Add content views.
- In the Add content views window, select the version of each Content View.
- Optional: If you want to automatically update the Content View to the latest version, select the Always update to latest version checkbox.
- Click Add, then click Publish new version.
- Optional: In the Description field, enter a description of the Content View.
- In the Publish window, set the Promote switch, then select the lifecycle environment.
- Click Next, then click Finish.
CLI procedure
Before you create the Composite Content Views, list the version IDs for your existing Content Views:
# hammer content-view version list \ --organization "My_Organization"
Create a new Composite Content View. When the
--auto-publish
option is set toyes
, the Composite Content View is automatically republished when a Content View it includes is republished:# hammer content-view create \ --composite \ --auto-publish yes \ --name "Example_Composite_Content_View" \ --description "Example Composite Content View" \ --organization "My_Organization"
Add a Content View to the Composite Content View. You can identify Content View, Content View version, and Organization in the commands by either their ID or their name. To add multiple Content Views to the Composite Content View, repeat this step for every Content View you want to include.
If you have the Always update to latest version option enabled for the Content View:
# hammer content-view component add \ --component-content-view-id Content_View_ID \ --composite-content-view "Example_Composite_Content_View" \ --latest \ --organization "My_Organization"
If you have the Always update to latest version option disabled for the Content View:
# hammer content-view component add \ --component-content-view-id Content_View_ID \ --composite-content-view "Example_Composite_Content_View" \ --component-content-view-version-id Content_View_Version_ID \ --organization "My_Organization"
Publish the Composite Content View:
# hammer content-view publish \ --name "Example_Composite_Content_View" \ --description "Initial version of Composite Content View" \ --organization "My_Organization"
Promote the Composite Content View across all environments:
# hammer content-view version promote \ --content-view "Example_Composite_Content_View" \ --version 1 \ --to-lifecycle-environment "Development" \ --organization "My_Organization" # hammer content-view version promote \ --content-view "Example_Composite_Content_View" \ --version 1 \ --to-lifecycle-environment "Testing" \ --organization "My_Organization" # hammer content-view version promote \ --content-view "Example_Composite_Content_View" \ --version 1 \ --to-lifecycle-environment "Production" \ --organization "My_Organization"
8.7. Content Filter Overview
Content Views also use filters to include or restrict certain Yum content. Without these filters, a Content View includes everything from the selected repositories.
There are two types of content filters:
Filter Type | Description |
---|---|
Include | You start with no content, then select which content to add from the selected repositories. Use this filter to combine multiple content items. |
Exclude | You start with all content from selected repositories, then select which content to remove. Use this filter when you want to use most of a particular content repository but exclude certain packages, such as blacklisted packages. The filter uses all content in the repository except for the content you select. |
Include and Exclude Filter Combinations
If using a combination of Include and Exclude filters, publishing a Content View triggers the include filters first, then the exclude filters. In this situation, select which content to include, then which content to exclude from the inclusive subset.
Content Types
You can filter content based on the following content types:
Content Type | Description |
---|---|
RPM | Filter packages based on their name and version number. The RPM option filters non-modular RPM packages and errata. Source RPMs are not affected by this filter and will still be available in the Content View. |
Package Group | Filter packages based on package groups. The list of package groups is based on the repositories added to the Content View. |
Erratum (by ID) | Select which specific errata to add to the filter. The list of Errata is based on the repositories added to the Content View. |
Erratum (by Date and Type) | Select a issued or updated date range and errata type (Bugfix, Enhancement, or Security) to add to the filter. |
Module Streams | Select whether to include or exclude specific module streams. The Module Streams option filters modular RPMs and errata, but does not filter non-modular content that is associated with the selected module stream. |
Container Image Tag | Select whether to include or exclude specific container image tags. |
8.8. Resolving Package Dependencies
Satellite can add dependencies of packages in a Content View to the dependent repository when publishing the Content View. To configure this, you can enable dependency solving.
For example, dependency solving is useful when you incrementally add a single package to a Content View version. You might need to enable dependency solving to install that package.
However, dependency solving is unnecessary in most situations. For example:
- When incrementally adding a security errata to a Content View, dependency solving can cause significant delays to Content View publication without major benefits.
- Packages from a newer erratum might have dependencies that are incompatible with packages from an older Content View version. Incrementally adding the erratum using dependency solving might include unwanted packages. As an alternative, consider updating the Content View.
Dependency solving only considers packages within the repositories of the Content View. It does not consider packages installed on clients. For example, if a Content View includes only AppStream, dependency solving does not include dependent BaseOS content at publish time.
For more information, see Limitations to Repository Dependency Resolution in Managing Content.
Dependency solving can lead to the following problems:
- Significant delay in Content View publication
Satellite examines every repository in a Content View for dependencies. Therefore, publish time increases with more repositories.
To mitigate this problem, use multiple Content Views with fewer repositories and combine them into composite Content Views.
- Ignored Content View filters on dependent packages
Satellite prioritizes resolving package dependencies over the rules in your filter.
For example, if you create a filter for security purposes but enable dependency solving, Satellite can add packages that you might consider insecure.
To mitigate this problem, carefully test filtering rules to determine the required dependencies. If dependency solving includes unwanted packages, manually identify the core basic dependencies that the extra packages and errata need.
Example 8.1. Combining exclusion filters with dependency solving
You want to recreate Red Hat Enterprise Linux 8.3 using Content View filters and include selected errata from a later Red Hat Enterprise Linux 8 minor release. To achieve this, you create filters to exclude most of the errata after the Red Hat Enterprise Linux 8.3 release date, except a few that you need. Then, you enable dependency solving.
In this situation, dependency solving might include more packages than expected. As a result, the host diverges from being a Red Hat Enterprise Linux 8.3 machine.
If you do not need the extra errata and packages, do not configure Content View filtering. Instead, enable and use the Red Hat Enterprise Linux 8.3 repository on the Content > Red Hat Repositories page in the Satellite web UI.
Example 8.2. Excluding packages sometimes makes dependency solving impossible for DNF
If you make a Red Hat Enterprise Linux 8.3 repository with a few excluded packages, dnf update
can sometimes fail.
Do not enable dependency solving to resolve the problem. Instead, investigate the error from dnf
and adjust the filters to stop excluding the missing dependency.
Else, dependency solving might cause the repository to diverge from Red Hat Enterprise Linux 8.3.
8.9. Enabling Dependency Solving for a Content View
Use this procedure to enable dependency solving for a Content View.
Prerequisite
- Dependency solving is useful only in limited contexts. Before enabling it, ensure you read and understand Section 8.8, “Resolving Package Dependencies”
Procedure
- In the Satellite web UI, navigate to Content > Content Views.
- From the list of content views, select the required Content View.
- On the Details tab, toggle Solve dependencies.
8.10. Content Filter Examples
Use any of the following examples with the procedure that follows to build custom content filters.
Filters can significantly increase the time to publish a Content View. For example, if a Content View publish task completes in a few minutes without filters, it can take 30 minutes after adding an exclude or include errata filter.
Example 1
Create a repository with the base Red Hat Enterprise Linux packages. This filter requires a Red Hat Enterprise Linux repository added to the Content View.
Filter:
- Inclusion Type: Include
- Content Type: Package Group
- Filter: Select only the Base package group
Example 2
Create a repository that excludes all errata, except for security updates, after a certain date. This is useful if you want to perform system updates on a regular basis with the exception of critical security updates, which must be applied immediately. This filter requires a Red Hat Enterprise Linux repository added to the Content View.
Filter:
- Inclusion Type: Exclude
- Content Type: Erratum (by Date and Type)
- Filter: Select only the Bugfix and Enhancement errata types, and clear the Security errata type. Set the Date Type to Updated On. Set the Start Date to the date you want to restrict errata. Leave the End Date blank to ensure any new non-security errata is filtered.
Example 3
A combination of Example 1 and Example 2 where you only require the operating system packages and want to exclude recent bug fix and enhancement errata. This requires two filters attached to the same Content View. The Content View processes the Include filter first, then the Exclude filter.
Filter 1:
- Inclusion Type: Include
- Content Type: Package Group
- Filter: Select only the Base package group
Filter 2:
- Inclusion Type: Exclude
- Content Type: Erratum (by Date and Type)
- Filter: Select only the Bugfix and Enhancement errata types, and clear the Security errata type. Set the Date Type to Updated On. Set the Start Date to the date you want to restrict errata. Leave the End Date blank to ensure any new non-security errata is filtered.
Example 4
Filter a specific module stream in a Content View.
Filter 1:
- Inclusion Type: Include
- Content Type: Module Stream
- Filter: Select only the specific module stream that you want for the Content View, for example ant, and click Add Module Stream.
Filter 2:
- Inclusion Type: Exclude
- Content Type: Package
-
Filter: Add a rule to filter any non-modular packages that you want to exclude from the Content View. If you do not filter the packages, the Content View filter includes all non-modular packages associated with the module stream ant. Add a rule to exclude all
*
packages, or specify the package names that you want to exclude.
For another example of how content filters work, see the following article: "How do content filters work in Satellite 6".
8.11. Creating a Content Filter for Yum Content
You can filter Content Views containing Yum content to include or exclude specific packages, package groups, errata, or module streams. Filters are based on a combination of the name, version, and architecture.
To use the CLI instead of the Satellite web UI, see the CLI procedure.
For examples of how to build a filter, see Section 8.10, “Content Filter Examples”.
Procedure
- In the Satellite web UI, navigate to Content > Content Views and select a Content View.
- On the Filters tab, click Create filter.
- Enter a name.
- From the Content type list, select a content type.
- From the Inclusion Type list, select either Include filter or Exclude filter.
- Optional: In the Description field, enter a description for the filter.
- Click Create filter to create your content filter.
- Depending on what you enter for Content Type, add rules to create the filter that you want.
- Select if you want the filter to Apply to subset of repositories or Apply to all repositories.
- Click Publish New Version to publish the filtered repository.
- Optional: In the Description field, enter a description of the changes.
Click Create filter to publish a new version of the Content View.
You can promote this Content View across all environments.
CLI procedure
Add a filter to the Content View. Use the
--inclusion false
option to set the filter to an Exclude filter:# hammer content-view filter create \ --name "Errata Filter" \ --type erratum --content-view "Example_Content_View" \ --description "My latest filter" \ --inclusion false \ --organization "My_Organization"
Add a rule to the filter:
# hammer content-view filter rule create \ --content-view "Example_Content_View" \ --content-view-filter "Errata Filter" \ --start-date "YYYY-MM-DD" \ --types enhancement,bugfix \ --date-type updated \ --organization "My_Organization"
Publish the Content View:
# hammer content-view publish \ --name "Example_Content_View" \ --description "Adding errata filter" \ --organization "My_Organization"
Promote the view across all environments:
# hammer content-view version promote \ --content-view "Example_Content_View" \ --version 1 \ --to-lifecycle-environment "Development" \ --organization "My_Organization" # hammer content-view version promote \ --content-view "Example_Content_View" \ --version 1 \ --to-lifecycle-environment "Testing" \ --organization "My_Organization" # hammer content-view version promote \ --content-view "Example_Content_View" \ --version 1 \ --to-lifecycle-environment "Production" \ --organization "My_Organization"
8.12. Deleting Multiple Content View Versions
You can delete multiple Content View versions simultaneously.
Procedure
- In the Satellite web UI, navigate to Content > Content Views.
- Select the Content View you want to delete versions of.
- On the Versions tab, select the checkbox of the version or versions you want to delete.
- Click the vertical ellipsis icon at the top of the list of Content Views.
- Click Delete to open the deletion wizard that shows any affected environments.
- If there are no affected environments, review the details and click Delete.
- If there are any affected environments, reassign any hosts or activation keys before deletion.
- Review the details of the actions.
- Click Delete.
8.13. Clearing the Search Filter
If you search for specific content types using keywords in the Search text box and the search returns no results, click Clear search to clear all the search queries and reset the Search text box.
If you use a filter to search for specific repositories in the Type text box and the search returns no results, click Clear filters to clear all active filters and reset the Type text box.
8.14. Standardizing Content View Empty States
If there are no filters listed for a content view, click Create filter. A modal opens to show you the next steps to create a filter. Follow these steps to add a new filter to create new content types.
8.15. Comparing Content View Versions
Use this procedure to compare Content View Version functionality for Satellite.
Procedure
- In the Satellite web UI, navigate to Content > Content Views.
- Select a Content View whose versions you want to compare.
- On the Versions tab, select the checkbox next to any two versions you want to compare.
Click Compare.
The Compare screen has the pre-selected versions in the version dropdown menus and tabs for all content types found in either version. You can filter the results to show only the same, different, or all content types. You can compare different Content View versions by selecting them from the dropdown menus.
8.16. Distributing Archived Content View Versions
The setting Distribute archived content view versions enables hosting of non-promoted Content View version repositories in the Satellite content web application along with other repositories. This is useful while debugging to see what content is present in your Content View versions.
Procedure
- In the Satellite web UI, navigate to Administer > Settings.
- Click the Content tab.
- Set the Distribute archived content view versions parameter to Yes.
Click Submit.
This enables the repositories of Content View versions without lifecycle environments to be distributed at
satellite.example.com/pulp/content/My_Organization/content_views/My_Content_View/My_Content_View_Version/
.NoteOlder non-promoted Content View versions are not distributed once the setting is enabled. Only new Content View versions become distributed.