Note:

Use Lifecycle Environments in Oracle OS Management Hub

Introduction

Learn to create a lifecycle environment to promote versioned custom software sources through its lifecycle stages in Oracle OS Management Hub. A lifecycle environment is a user-defined pipeline to deliver select, versioned content in an ordered manner.

Instances best suited for lifecycle environments are appliance-like and have minimal tolerance for variability in their installed software. You deliver updates to instances as fixed versions of content that you define within a versioned custom software source. The only time the content changes is when a new versioned custom software source is created and promoted to a stage.

You can create a lifecycle environment with a maximum of five stages and assign instances to each stage. Then, create a versioned custom software source with specific package updates to promote through the stages. Promotion installs all content in the versioned source onto the instances in the stage. To learn more about lifecycle environments, visit the Understanding Lifecycle Environment Documentation.

Objectives

In this tutorial, you’ll learn how to:

Prerequisites

Access to an Oracle Cloud Infrastructure tenancy with:

Configure OCI Resources

Note: If running in your tenancy, read the linux-virt-labs GitHub project README.md and complete the prerequisites before deploying the lab environment.

  1. Open a terminal on the Luna Desktop.

  2. Clone the linux-virt-labs GitHub project.

    git clone https://github.com/oracle-devrel/linux-virt-labs.git
    
  3. Change into the working directory.

    cd linux-virt-labs/ol
    
  4. Install the required collections.

    ansible-galaxy collection install -r requirements.yml
    
  5. Update the Oracle Linux instance configurations.

    cat << EOF | tee instances.yml > /dev/null
    compute_instances:
      1:
        instance_name: "ol-host-01"
        type: "server"
      2:
        instance_name: "ol-host-02"
        type: "server"
      3:
        instance_name: "ol-host-03"
        type: "server"
    instance_shape: "VM.Standard.E5.Flex"
    EOF
    
  6. Deploy the lab environment.

    ansible-playbook create_instance.yml -e localhost_python_interpreter="/usr/bin/python3.6" -e "@instances.yml"
    

    The free lab environment requires the extra variable localhost_python_interpreter, which sets ansible_python_interpreter for plays running on localhost. This variable is needed because the environment installs the RPM package for the Oracle Cloud Infrastructure SDK for Python, located under the python3.6 modules.

    The default deployment shape uses the AMD CPU and Oracle Linux 8.

  7. Wait for the playbook to reach the pause task. Do not hit enter or close the terminal. The playbook creates OCI compute instances and resources to use with OS Management Hub. Progress to the next step when the pause task is displayed.

    Important: Do not hit enter or close the terminal window for the duration of the lab. Minimize the window and continue with the next steps.

Access the OS Management Hub Section on the OCI Console

  1. Open the OCI console in a browser.

  2. Use your account username and password to login to the OCI console.

  3. Use the navigation menu of the OCI console landing page to navigate to Observability and Management and click on OS Management Hub.

    osmh_nav1

Create the Lifecycle Environment

You must create a lifecycle environment and define its stages (for example, development, test, and production). A minimum of two stages is required. The maximum is five stages.

  1. Click on Lifecycle environments under the OS Management Hub navigation section.

  2. Click Create.

  3. Enter the following name for the lifecycle environment:

    Lifecycle_ol8
    
  4. Optionally, enter a description.

  5. Set the location as Oracle Cloud Infrastructure.

  6. Specify the OS and architecture information as the following:

    • OS vendor: Oracle
    • OS version: Oracle Linux 8
    • Architecture: x86_64

    Note: These software source selections must match the compute instances that you intend to use.

  7. Define three stages for the lifecycle environment.

    1. Enter the following name for the first stage.

      Development
      
    2. Enter the following name for the second stage.

      Test
      
    3. Click Add stage and enter the following name for the third stage.

      Production
      
  8. Click Create.

  9. On the Lifecycle environments page, click on Lifecycle_ol8 to view the lifecycle environment’s details page.

    The lifecycle details page displays important information, including its stages, associated instances, jobs, and reports.

Creating a Lifecycle Environment Profile

Create profiles so that you can associate instances with lifecycle stages when registering the instance with OS Management Hub.

You will need to create a registration profile for each stage in the lifecycle and then register instances or attach instances already managed by OS Management Hub.

Create the Development Stage Profile

  1. Click Create Profile on the Lifecycle_ol8 Details page.

    osmh_lifecycle_profile_1

  2. Enter the following name for the Development profile:

    Dev_Lifecycle_ol8
    
  3. Optionally, enter a description.

  4. Select the Development lifecycle stage.

  5. Click Create.

Create the Test Stage Profile

  1. Click Create Profile again on the Lifecycle_ol8 Details page.

  2. Enter the following name for the Test profile:

    Test_Lifecycle_ol8
    
  3. Optionally, enter a description.

  4. Select the Test lifecycle stage.

  5. Click Create.

Create the Production Stage Profile

  1. Click Create Profile again on the Lifecycle_ol8 Details page.

  2. Enter the following name for the Production profile:

    Prod_Lifecycle_ol8
    
  3. Optionally, enter a description.

  4. Select the Production lifecycle stage.

  5. Click Create.

    These stage-specific profiles and their details can be viewed on the Profiles page under the OS Management Hub menu.

Assign Instances to each Stage in the Lifecycle Environment

You can use these lifecycle stage-specific profiles when registering instances with OS Management Hub.

  1. Navigate to the Compute service and select Instances using the main OCI navigation menu.

    osmh_compute_nav1

Register Existing Compute Instances

To register OCI compute instances to OS Management Hub and attach them to specific lifecycle stages, you must enable the Oracle Cloud Agent (OCA) plugin and select the lifecycle stage profile. Use each lifecycle stage profile to register one instance.

Register an Instance to the Development Stage

  1. Click Instances under the Compute section and click on the ol-host-01 instance.

  2. Click on the Oracle Cloud Agent tab on the compute instance’s details page.

  3. Enable the OS Management Hub Agent plugin and set the OS Management Hub service profile to Dev_Lifecycle_ol8.

    osmh_lifecycle_profile_set

    In some situations, the OS Management Hub Agent shows as stopped after being enabled. Ignore this and proceed to the next step.

Register an Instance to the Test Stage

  1. Return to Instances under the Compute section and click on the ol-host-02 instance.

  2. Click on the Oracle Cloud Agent tab on the compute instance’s details page.

  3. Enable the OS Management Hub Agent plugin and set the OS Management Hub service profile to Test_Lifecycle_ol8.

Register an Instance to the Production Stage

  1. Return to Instances under the Compute section and click on the ol-host-03 instance.

  2. Click on the Oracle Cloud Agent tab on the compute instance’s details page.

  3. Enable the OS Management Hub Agent plugin and set the OS Management Hub service profile to Prod_Lifecycle_ol8.

  4. Navigate back to the Lifecycle_ol8 details page. Wait for the instance to register with the Lifecycle_ol8 lifecycle environment.

    osmh_lifecycle_registered

    Note: This step may take several minutes. Refresh the page and wait for the instance counts for each stage to reach 1.

Manage Attached Instances

You can no longer manage attached instances as standalone instances. Managing attached instances occurs from the Resources section on the Lifecycle Environment details page.

  1. Click Instances under Resources on the Lifecycle details page.

    The Instance resource lists each instance and its associated stage, compartment location, and status. Instances can be attached, detached, and rebooted from this resource.

Important: When attaching an instance to a lifecycle stage, the service:

Create the Versioned Custom Software Source

Now that the stages have been defined and instances associated, the lifecycle environment is ready for versioned custom software content. A versioned custom software source is a custom software source specifically used with lifecycle environments.

A versioned custom software source has several distinct attributes:

Carefully select the packages and modules in the versioned custom software source. When promoted to a lifecycle stage, the service installs all content in the source to the attached instances.

  1. Click Software Sources under the OS Management Hub navigation section.

  2. Select Create custom software source from the action menu.

Add Basic Details

  1. Enter the following name for the versioned custom software source:

    Ol8_monthly_update
    
  2. Optionally, enter a description.

  3. Enter the following version identifier:

    1.0
    

    Adding a version disables the automatically update content option.

  4. Disable Automatically resolve dependencies.

    Important: When auto-resolve is enabled, the service automatically resolves package and module dependencies. Dependency resolution only includes packages from vendor software sources that are selected for the custom software source. If a dependent package resides in a software source that’s not associated with the custom software source, the package will not be included.

  5. Click Next.

Select Software Sources

  1. Specify the OS version, vendor, and architecture as the following:

    • OS vendor: Oracle
    • OS version: Oracle Linux 8
    • Architecture: x86_64
  2. Keep the default compartment selected since it contains vendor software sources.

  3. Select the software sources that the registration profile will assign. Select the following:

    • ol8_baseos_latest-x86_64
    • ol8_appstream-x86_64
    • ol8_addons-x86_64
    • ol8_uekr6-x86_64
  4. Click Next.

Select Package Content

Specify the packages for the versioned custom software source. You can use either filters or a package list to identify specific content.

Provide a Package List

  1. Select Provide package list.

  2. Only include the latest version is enabled. This option is required for versioned custom software sources.

  3. Select Paste package list.

  4. Paste the following package list into the window:

    pam-1.3.1-27.el8.x86_64
    openssl-libs-1.1.1k-12.el8_9.x86_64
    libreport-filesystem-2.9.5-15.0.4.el8.x86_64
    
  5. Click Next.

Review

  1. Review and click Submit.

    A create software source job named Create Ol8_monthly_update and refresh metadata is in-progress on the Jobs page under the OS Management hub section.

When the create software source job completes, the versioned custom software source is ready to be promoted to the first stage in the lifecycle environment.

Promote a Versioned Custom Software Source into the Lifecycle Environment

The first step for a versioned custom software sources and their content is to be promoted to the first stage in the lifecycle environment.

When the versioned custom software source is promoted to a stage, the service:

Check out the documentation for another example of promoting content through lifecycle stages.

Promote the Versioned Custom Software

  1. On the Lifecycle environment page, click on Lifecycle_ol8 to view the lifecycle environment’s details page.

  2. Select Development stage on the list. This stage is the first stage in the lifecycle environment.

  3. Click Promote content.

  4. Keep the default name for the promotion job.

  5. Enter an optional description for the promotion job.

  6. Keep the default compartment selection.

  7. Select Ol8_monthly_update from the available versioned custom software sources.

  8. Schedule the promotion job to Run immediately.

  9. Click Promote.

View the Promotion Job

  1. View the promotion job status by clicking on the Jobs resource and selecting the In Progress jobs tab.

    When the promotion job is complete, the job will move to the Completed jobs tab.

  2. Click on the name of the Promote software source to Lifecycle_ol8 Development job to view its Job work details.

  3. On the Associated work resource, two jobs are listed. The first job assigns the versioned custom software source to all instances associated with the Development stage, and the second job installs the content to the instance.

In this case, there is only one associated instance, so there is only one install job. If there were multiple instances associated with the stage, there would be multiple install jobs listed.

Promote a Versioned Custom Software Source to the Next Stage

To promote versioned custom software source to the next stage in the lifecycle environment, return to the lifecycle’s Stages resource.

Promote to the Test Stage

  1. On the Lifecycle environment page, click on Lifecycle_ol8 to view the lifecycle environment’s details page.

  2. Select test stage on the list. This stage is the second stage in the lifecycle environment.

  3. Click Promote content.

  4. Keep the default name for the promotion job.

  5. Enter an optional description for the promotion job.

  6. Schedule the promotion job to Run immediately.

  7. Click Promote.

The promotion job is viewable under the Jobs resource. It will assign and install the versioned custom software source from the preceding lifecycle stage to its associated instances.

Promote to the Production Stage

The final promotion in this 3-stage lifecycle environment assigns and installs the versioned custom software source to the Production stage.

  1. Select Production stage on the list. This stage is the third stage in the lifecycle environment.

  2. Click Promote content.

  3. Keep the default name for the promotion job.

  4. Enter an optional description for the promotion job.

  5. Schedule the promotion job to Run immediately.

  6. Click Promote.

    The promotion job is viewable under the Jobs resource.

Next Steps

As updates to packages and content included in the versioned custom software source become available for development and testing, you would create a new versioned custom software source with a new version indicator and promote it into the lifecycle environment starting at the first stage. This user-defined pipeline creates a controlled environment to deliver select content in a staged manner.

More Learning Resources

Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.

For product documentation, visit Oracle Help Center.