Creating Sync Plan

Right after creating the repositories let us create a sync plan to download the contents periodically every day or weekly or monthly.

Content –> Sync Plan –> Create Sync Plan

The sync plan we created is daily at 4 PM. Click save to create the Sync plan. Once created with Daily Sync plan click on Products Tab and add the listed product.

Sync Plans –> Daily Sync –> Products –> Add —> Select the products and click “Add selected”.

Syncing the Contents

To sync the content navigate to Content –> Sync Status –> Select All –> Click the “Synchronize Now”.

To check the status from the command line run

[[email protected] ~]# hammer product list  --name "CentOS 7 Linux x86_64" --organization-id 1
---|-----------------------|-------------------------------|----------------------|--------------|-----------
ID | NAME                  | DESCRIPTION                   | ORGANIZATION         | REPOSITORIES | SYNC STATE
---|-----------------------|-------------------------------|----------------------|--------------|-----------
1  | CentOS 7 Linux x86_64 | Repository for CentOS 7 Linux | Default Organization | 5            | Running   
---|-----------------------|-------------------------------|----------------------|--------------|-----------
[[email protected] ~]#

Once the sync completed it will look similar to below.

Creating a LifeCycle Environment

The LifeCycle environment helps us to provide the required stages. For example,

  • A set of packages needs to be used in a development machine. The same packages need to be used under production once your developer completed his work. So what we will do is move the content from dev stage to production by promoting it to production.
  • In other cases, Maybe your development team need separate content and your production required a separate set of content. It’s too possible.

Create a lifecycle environment by navigating to Content –> Lifecycle Environments we will create three environments as follows.

  • Development
  • Testing
  • Production

Create a Development environment.

Next, create our Testing Environment. While creating the testing env choose the Prior Environment as “Development”.

Finally, create the Production environment. As shown in the previous step select the “Testing” as a prior environment while creating the Production Env.

This is how our LifeCycle Environment Paths will look like.

Creating Content View

The content view is a version control system in Katello/Satellite. It can consist of one or more repositories. To create a content view navigate to

Content –> Content Views –> Create New view

Click save to create the Content view.

Creating Content View
Creating Content View

Right after creating the content view it will take you to “Yum content” Tab under the created content view, We can see the list of repositories under this section select the required repos from the list and click “Add Repositories” to add the same.

  1. Click Add Tab under Yum content.
  2. Select all repositories
  3. Finally, click the add repositories button at the right-hand side.

The added repositories can be seen under List TAB.

Publishing the Content

To publish the content click on “Publish New Version” at the top right-hand corner. Type with a short description and click Save.

  1. Click Publish New version to publish the content.
  2. Click save with continuing to publish to the Library.

Once clicking on Save we will get the status as shown below.

After publishing a new version it will be under Library Environment.

Then promote to Development. Select the tick next to Development and promote the version.

Promote to Development
Promote to Development

At last, promote to Production.

Promote to Production
Promote to Production

It will look similar to below.

Finally published environment
Finally published environment

The promoted history can be viewed from the “History” tab.

Promote history
Promote history

Creating an Activation key

Activation Keys provide a mechanism to define properties that may be applied to Content Hosts during registration. Let’s create an activation key for our content hosts by navigating to

Content –> Activation Keys –> Create Activation key

Here “content Host” means the server (clients) which we are going to register with foreman/Katello/Satellite.

  1. Name of the activation key
  2. Description of the activation key
  3. For which environment the key need to be used.
  4. Content view which needs to use the activation key
  5. Click save to create the activation key.

To create the key from command line we need to know about the organization, lifecycle environments and content view.

List the organization

[[email protected] ~]# hammer organization list
---|----------------------|----------------------|-------------|---------------------
ID | TITLE                | NAME                 | DESCRIPTION | LABEL               
---|----------------------|----------------------|-------------|---------------------
1  | Default Organization | Default Organization |             | Default_Organization
---|----------------------|----------------------|-------------|---------------------
[[email protected] ~]#

List the LifeCycle Environments

[[email protected] ~]# hammer lifecycle-environment list
---|-------------|------------
ID | NAME        | PRIOR      
---|-------------|------------
5  | Development | Library    
1  | Library     |            
8  | Production  | Testing    
7  | Testing     | Development
---|-------------|------------
[[email protected] ~]#

And list the Content View

[[email protected] ~]# hammer content-view list
----------------|---------------------------|---------------------------|-----------|---------------------|---------------
CONTENT VIEW ID | NAME                      | LABEL                     | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS
----------------|---------------------------|---------------------------|-----------|---------------------|---------------
4               | CentOS 7                  | CentOS_7                  | false     | 2020/03/22 14:03:41 | 8, 3, 2, 4, 9 
1               | Default Organization View | Default_Organization_View | false     | 2020/03/20 23:50:12 |               
----------------|---------------------------|---------------------------|-----------|---------------------|---------------
[[email protected] ~]#

Once we get all above the information let’s create the activation key. We will create with separate activation key for development, testing and production.

Activation Key for Development.

# hammer activation-key create --organization-id 1 \
--name "CentOS7_Dev" \
--description "CentOS 7 Activation Key for Development/Test Servers" \
--lifecycle-environment "Development" \
--purpose-role "Red Hat Enterprise Linux Server" \
--purpose-usage "Development/Test" \
--content-view "CentOS 7" \
--unlimited-hosts

Key for Testing.

# hammer activation-key create --organization-id 1 \
--name "CentOS7_Tst" \
--description "CentOS 7 Activation Key for Development/Test Servers" \
--lifecycle-environment "Testing" \
--purpose-role "Red Hat Enterprise Linux Server" \
--purpose-usage "Development/Test" \
--content-view "CentOS 7" \
--unlimited-hosts

At last, Activation key for Production.

# hammer activation-key create --organization-id 1 \
--name "CentOS7_Prod" \
--description "CentOS 7 Activation Key for Production Servers" \
--lifecycle-environment "Production" \
--purpose-role "Red Hat Enterprise Linux Server" \
--purpose-usage "Production" \
--content-view "CentOS 7" \
--unlimited-hosts

List all created activation key from the command line for default organization “1“.

[[email protected] ~]# hammer activation-key list --organization-id 1
---|--------------|----------------|-----------------------|-------------
ID | NAME         | HOST LIMIT     | LIFECYCLE ENVIRONMENT | CONTENT VIEW
---|--------------|----------------|-----------------------|-------------
10 | CentOS7_Dev  | 0 of Unlimited | Development           | CentOS 7    
12 | CentOS7_Prod | 0 of Unlimited | Production            | CentOS 7    
11 | CentOS7_Tst  | 0 of Unlimited | Testing               | CentOS 7    
---|--------------|----------------|-----------------------|-------------
[[email protected] ~]#

Adding Subscription to Activation Key

Now, time to add the subscription into the created activation key. So, once anyone of server registered with katello server it will be assigned with respective Subscription and Repositories.

# hammer subscription list --organization-id 1
# hammer activation-key add-subscription --organization-id 1 --name "CentOS7_Dev" --quantity "1" --subscription-id "1"
# hammer activation-key add-subscription --organization-id 1 --name "CentOS7_Tst" --quantity "1" --subscription-id "1"
# hammer activation-key add-subscription --organization-id 1 --name "CentOS7_Prod" --quantity "1" --subscription-id "1"

Subscribing clients with Foreman/Katello

Subscribing content host with the foreman will be taken through the below guide.

Subscribe Linux server with Foreman/Katello

That’s it, we have successfully completed with Installing foreman with Katello. In our upcoming guide let see how to subscribe to a client with katello.

Conclusion

Foreman with Katello or Satellite sever is used for content management, version control or we can call as a patch management tool. This one is most needed in any critical production environment to solve the content management / Patch Management requirements. Subscribe to our newsletter and stay with us to receive more topics on Foreman Katello.

LEAVE A REPLY

Please enter your comment!
Please enter your name here