Bookmark this page

Guided Exercise: Create Content View Filters

Create a composite content view, and use a content view filter to limit which packages are visible to hosts.

Outcomes

  • Create a composite content view.

  • Configure a content view filter.

As the student user on the workstation machine, use the lab command to prepare your system for this exercise.

This command prepares your environment and ensures that all required resources are available.

[student@workstation ~]$ lab start software-filter

Instructions

  1. Log in to the web UI, https://satellite.lab.example.com, as admin with redhat as the password.

  2. In the upper-left corner of the web page, set the organization to Operations. Set the location to Any Location.

  3. Enable synchronization of the Red Hat Enterprise Linux 9 for x86_64 - High Availability (RPMs) repository.

    1. Click ContentRed Hat Repositories.

    2. Enter rhel-9-for-x86_64-highavailability-rpms in the Search field, and then click Search.

    3. In the Available Repositories list, click the greater-than symbol (>) to the left of the Red Hat Enterprise Linux 9 for x86_64 - High Availability (RPMs) repository to expand the version information. Click the plus sign (+) to the right of x86_64 9 to enable that repository and version. Verify that the client repository is listed in the Enabled Repositories list, and that the repository is for RHEL 9.

  4. Synchronize the Red Hat Enterprise Linux 9 for x86_64 - High Availability (RPMs) repository.

    1. Click ContentProducts and then click Red Hat Enterprise Linux High Availability for x86_64.

    2. On the Repositories tab, select the checkbox for the Red Hat Enterprise Linux 9 for x86_64 - High Availability RPMs 9 repository, and then click Sync Now. Wait for the task to complete.

  5. Create the OpsBaseHA content view.

    1. Click ContentContent Views and click Create content view.

    2. On the Create content view page, enter OpsBaseHA in the Name field. The Label field is autogenerated from the Name field.

    3. Enter High availability packages in the Description field, and then click Create content view to display the Repositories selection page.

    4. Select the Red Hat Enterprise Linux 9 for x86_64 - High Availability RPMs 9 repository, and then click Add repositories.

  6. Create a filter for the OpsBaseHA content view and configure it to exclude Pacemaker packages that are earlier than version 2.1.4.

    1. On the OpsBaseHA content view web page, click the Filters tab, and then click Create filter.

    2. Complete the Create filter page with the following details. Verify that the fields are correct, and then click Create filter.

      FieldValue
      NamePacemaker-before-2.1.4
      Content TypeRPM
      Inclusion TypeExclude
      DescriptionExcluding Pacemaker packages earlier than 2.1.4
    3. Click Add RPM rule to start adding a new rule to the filter.

    4. Create a rule with the following details:

      FieldValue
      RPM Namepacemaker
      Architecturex86_64
      VersionLess Than
      Maximum Version2.1.4

      Verify that the fields are correct, and then click Add rule.

  7. Publish a new version of the OpsBaseHA content view, and promote this version to the Development lifecycle environment.

    1. Click Publish new version to display the Publish page.

    2. Enter HA repository in the Description field, and then click Next. Review the details and click Finish.

    3. After the content view is published, the Versions tab is selected. The OpsBaseHA content view is in the Library environment. Click Promote.

    4. Select the checkbox for Development, and enter HA repository in the Description field. Click Promote to start the promotion. Wait for the promotion to complete.

  8. Create a composite view named BaseHAComposite, which includes both the OperationsServerBase and OpsBaseHA content views.

    1. Click ContentContent Views, and then click Create content view.

    2. On the Create content view page, enter BaseHAComposite in the Name field. The Label field is autogenerated from the Name field.

    3. Enter Server base and HA packages in the Description field. Select the Composite content view type. Select the Auto Publish checkbox, and then click Create content view.

    4. Select the checkboxes for the OperationsServerBase and OpsBaseHA content views, and then click Add content views. In the Add content views dialog, review the information, and then click Add.

    5. In the Content views tab, verify that the status for both content views is Added.

  9. Publish a new version of the BaseHAComposite composite view, and promote this version to the Development lifecycle environment.

    1. Click Publish new version.

    2. Enter Server base and HA content views repositories in the Description field and click Next. Review the details and then click Finish.

    3. After the composite content view is published, the Versions tab is displayed. The BaseHAComposite composite view is published to the Library environment. Click Promote.

    4. Select the Development lifecycle, and enter Server base and HA content views repositories in the Description field. Click Promote to start the promotion. Wait for the promotion to complete.

  10. Update the serverc content host to use the BaseHAComposite content view in the Development environment of the Operations organization.

    1. On workstation, log in to the serverc system as the student user and switch to the root user.

      [student@workstation ~]$ ssh student@serverc
      [student@serverc ~]$ sudo -i
      [sudo] password for student: student
      [root@serverc ~]#
    2. Verify the current environment and content view for the serverc content host. The serverc host is in the QA environment with the OperationsServerBase content view.

      [root@serverc ~]# subscription-manager identity
      system identity: 3244ed9d-ce23-4a2a-a39d-112324d84b3c
      name: serverc.lab.example.com
      org name: Operations
      org ID: Operations
      environment name: QA/OperationsServerBase
    3. In a different terminal window on workstation, log in to the satellite system as the student user and switch to the root user. Update the serverc host's lifecycle environment and content view. Because the serverc host is already in the Operations organization, the task is only a host update and does not require another host registration. After the command completes successfully, keep open the satellite terminal window.

      [student@workstation ~]$ ssh student@satellite
      [student@satellite ~]$ sudo -i
      [sudo] password for student: student
      [root@satellite ~]#
      [root@satellite ~]# hammer host update --name serverc.lab.example.com \
      --lifecycle-environment Development \
      --content-view BaseHAComposite \
      --organization Operations
      Host updated.
    4. In the terminal window on the serverc host, verify that the environment and content view are updated. The serverc host is in the Development environment with the BaseHAComposite content view.

      [root@serverc ~]# subscription-manager identity
      system identity: 3244ed9d-ce23-4a2a-a39d-112324d84b3c
      name: serverc.lab.example.com
      org name: Operations
      org ID: Operations
      environment name: Development/BaseHAComposite
  11. Verify that the serverc host has access to the repositories for the BaseHAComposite content view. Verify the pacemaker package versions that are available on the serverc host.

    1. Verify the repositories that are available on the serverc host. The repositories are from the BaseHAComposite content view.

      [root@serverc ~]# subscription-manager repos --list
      1 local certificate has been deleted.
      +----------------------------------------------------------+
          Available Repositories in /etc/dnf.repos.d/redhat.repo
      +----------------------------------------------------------+
      Repo ID:   rhel-9-for-x86_64-highavailability-rpms
      Repo Name: Red Hat Enterprise Linux 9 for x86_64 - High Availability (RPMs)
      Repo URL:  https://satellite.lab.example.com/pulp/content/Operations/Develop...
      Enabled:   0
      
      Repo ID:   rhel-9-for-x86_64-baseos-rpms
      Repo Name: Red Hat Enterprise Linux 9 for x86_64 - BaseOS (RPMs)
      Repo URL:  https://satellite.lab.example.com/pulp/content/Operations/Develop...
      Enabled:   1
      
      Repo ID:   satellite-client-6-for-rhel-9-x86_64-rpms
      Repo Name: Red Hat Satellite Client 6 for RHEL 9 x86_64 (RPMs)
      Repo URL:  https://satellite.lab.example.com/pulp/content/Operations/Develop...
      Enabled:   1
      
      Repo ID:   rhel-9-for-x86_64-appstream-rpms
      Repo Name: Red Hat Enterprise Linux 9 for x86_64 - AppStream (RPMs)
      Repo URL:  https://satellite.lab.example.com/pulp/content/Operations/Develop...
      Enabled:   1
    2. Enable the rhel-9-for-x86_64-highavailability-rpms repository.

      [root@serverc ~]# subscription-manager repos \
      --enable=rhel-9-for-x86_64-highavailability-rpms
      Repository 'rhel-9-for-x86_64-highavailability-rpms' is enabled for this system.
    3. Verify which pacemaker package versions are available. Of the several listed versions, none are earlier than version 2.1.4, as specified in the content view's exclude filter.

      [root@serverc ~]# dnf list pacemaker --showduplicates
      Updating Subscription Management repositories.
      Red Hat Enterprise Linux 9 for x86_64 - BaseOS   78 kB/s | 2.4 kB     00:00
      Red Hat Enterprise Linux 9 for x86_64 - High Av  85 kB/s | 2.6 kB     00:00
      Red Hat Satellite Client 6 for RHEL 9 x86_64 (R  65 kB/s | 2.1 kB     00:00
      Red Hat Enterprise Linux 9 for x86_64 - AppStre  66 kB/s | 2.4 kB     00:00
      Available Packages
      pacemaker.x86_64     2.1.4-5.el9         rhel-9-for-x86_64-highavailability-rpms
      pacemaker.x86_64     2.1.4-5.el9_1.2     rhel-9-for-x86_64-highavailability-rpms
  12. Delete the Pacemaker-before-2.1.4 filter from the OpsBaseHA content view. Republish the OpsBaseHA and BaseHAComposite content views.

    Important

    In the following steps, you must delete the filters that you created in this exercise, because active filters can significantly increase a content view's synchronization time. Deleting the filters from your content views shortens your synchronization wait time in later exercises.

    1. In the terminal window on the satellite system, delete the Pacemaker-before-2.1.4 filter.

      [root@satellite ~]# hammer content-view filter delete \
      --name Pacemaker-before-2.1.4 \
      --content-view OpsBaseHA \
      --organization Operations
      Filter deleted.
    2. Publish and promote a new version of the OpsBaseHA content view to the Development lifecycle environment.

      [root@satellite ~]# hammer content-view publish \
      --name OpsBaseHA \
      --lifecycle-environments Development \
      --organization Operations
      [.....................................................................] [100%]
    3. Update the BaseHAComposite composite content view with the latest version of the OpsBaseHA content view.

      [root@satellite ~]# hammer content-view component update \
      --latest \
      --component-content-view OpsBaseHA \
      --composite-content-view BaseHAComposite \
      --organization Operations
      Content view component updated.
    4. Publish and promote a new version of the BaseHAComposite composite content view to the Development lifecycle environment.

      [root@satellite ~]# hammer content-view publish \
      --name BaseHAComposite \
      --lifecycle-environments Development \
      --organization Operations
      [.....................................................................] [100%]
    5. Exit and close the terminal window to the satellite system.

      [root@satellite ~]# exit
      logout
      [student@satellite ~]$ exit
      logout
      [student@workstation ~]$ exit
      logout
    6. In the serverc terminal window, return to the workstation system as the student user.

      [root@serverc ~]# exit
      logout
      [student@serverc ~]$ exit
      logout
      [student@workstation ~]$

Finish

On the workstation machine, change to the student user home directory and use the lab command to complete this exercise. This step is important to ensure that resources from previous exercises do not impact upcoming exercises.

The lab finish command verifies that the filter was removed, and the content views republished..

[student@workstation ~]$ lab finish software-filter

Revision: rh403-6.11-3ad886e