How to change Lifecycle Environment and Content View for Content Hosts using hammer command line and from Satellite Web UI?

Solution Verified - Updated

Environment

  • Red Hat Satellite 6

Issue

  • What are the steps to change the Content View and Life Cycle Environment to another for a specific content host to fetch the repositories.?
  • How to change Life Cycle Environment and Content Views for Content Hosts using the hammer command line and from Satellite Web UI?

Resolution

  • First, identify the available organizations, content views, and lifecycle environments. Replace the organization name in the examples with your own:

    hammer organization list
    hammer content-view list --organization=My_Organization
    hammer lifecycle-environment list --organization=My_Organization
    
  • To change the Lifecycle Environment and Content View for a specific content host using the hammer command line, run:

    hammer host update --name client.example.com --lifecycle-environment "ENV_NAME" --content-view "CV_NAME" --organization-id <ORG_ID>
    

    Note : Parameter --organization ORG_NAME can be used in place of --organization-id ORG_ID if you wish to use organization name instead of ID.

  • To achieve the same through Satellite Web UI, navigate to the following page:

    Updating multiple hosts:

    • All Hosts page (New UI):

      Satellite Web UI: Hosts → All Hosts → Select Hosts → Click vertical ellipsis(⋮) near the search field → Manage content → Content view environments

      Select environment and content view and click Save

    • Content Hosts page (Old UI):

      Satellite Web UI: Hosts → Content Hosts → Select Hosts → Select Action → Change Lifecycle Environment

      Select Lifecycle Environment and Content View and click Assign

    Updating single host:

    • New Hosts UI:

      Satellite Web UI: Hosts → All Hosts → Click on the host → Click vertical ellipsis(⋮) inside Content view environment card

      Select environment and content view and click Save

    • Content Hosts UI (Old UI):

      Satellite Web UI: Hosts → Content Hosts → Click on the host → Details tab → Content Host Content → Change the Content View and Lifecycle Environment

  • Changes made through the Satellite Web UI or Hammer CLI will get applied to the hosts after the next automatic subscription-manager data refresh. To apply the changes on the host immediately, perform the following steps:

    • Once the Lifecycle Environment and Content View are updated in Satellite, refresh the client host to pull new repository details:

      subscription-manager refresh
      yum clean all
      
    • Optional (manual cache removal):

      rm -rfv /var/cache/{yum,dnf}/* 
      

      This ensures that stale metadata and cached packages are cleared, allowing the host to fetch the latest repositories from Satellite.

SBR
Product(s)
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.