Managing CentOS streams with foreman

Linux China 2021-10-14 04:29:27

This example shows us in Foreman Manage and configure in CentOS Stream Many options for content .

2021 year 12 month ,CentOS 8 Will reach the end of life , By CentOS Stream replace .CentOS Stream and CentOS One of the main changes between previous iterations is that there are no small versions .Centos Stream A continuous release cycle is adopted . Since the beginning of this year ,Foreman Community developers are beginning to see CentOS Stream The benefits of earlier error detection and patches due to continuous release . We no longer need to wait for the next release to take advantage of the latest changes and bug fixes .  Pointed out that , This also makes RHEL Developers are closer than ever to FOSS Community .

However , If you are an administrator with hundreds or thousands of servers , You may want to control when new packages are added to a specific server . If you are looking for a free open source tool , Help you ensure the stability of the production server , At the same time, it allows you to safely from Centos Stream Pull in the latest changes for development and testing , This is it. Foreman Where I can help you . With Foreman, You can manage your environment at all stages of the lifecycle Centos Stream Content .

Foreman Introduce

Foreman Is a complete lifecycle management tool for physical and virtual servers . With Foreman, System administrators have the ability to easily automate repetitive tasks , Rapidly deploy applications , And actively manage internal or cloud servers .Foreman by Equipped with provisioning management 、 Configuration management and monitoring provide enterprise class solutions . Because of its plug-in architecture ,Foreman It can be extended in countless ways . Use Katello plug-in unit , You can take Foreman As a complete Content management content management Tools to manage CentOS Stream, And many other content types .

adopt Foreman and Katello, You can define exactly which packages you want each environment to contain . for example , Production environments may use packages that have been verified to be stable , The development environment may need to be up-to-date 、 State of the art package version . You can also promote... Across life cycle environments Content view content view. Let's see Foreman How to accomplish this task .

We used the web user interface in this article , but Foreman There is also a strong CLI and API.Katello Plug in Pulp The project provides a workflow and web user interface , You can    Learn more about . We also provide a simple workflow here , however Foreman and Katello The project provides many different configuration options to meet your specific needs .

This paper assumes that Foreman and Katello Installed . More information on how to install , see also  .

Create a product

The first step is to Foreman Create a product product. The function of the product is to store... As an internal label CentOS Stream The repository .

  1. stay Foreman Web user interface , Navigate to “ Content Content >  product Products”, And click the “ Create products Create Product”.
  2. stay “ name Name” Field , Enter a name for the product .Foreman According to your input “ name Name” Done automatically “ label Label” Field , You can't change it later .

take CentOS Stream Add repository to product

Now you have a product , You can use AppStream and BaseOS Repository's URL, And add them to your new product .

  1. stay Foreman In the web user interface , Navigate to “ Content Content >  product Products”, Choose the product you want to use , And then click “ New repository New Repository”.
  2. stay “ name Name” Field , Enter a name for the repository ; for example ,“Centos8StreamBaseOS”.Foreman According to your input “ name Name”, Done automatically “ label Label” Field .
  3. from “ type Type” In the list , Select the type of Repository , And then choose “Yum”.
  4. stay “URL” Field , Input CentOS Stream Baseos Repository's URL, As the source :
  5. choice “ Download rules Download Policy” list . The default is “ On demand On Demand”, It means Katello Only metadata will be downloaded . If you want to download all the packages , Please change it into “ instant Immediate”, It can download all software packages , May reach 20-30GB.
  6. Make sure “ Synchronize with mirror Mirror on Sync” The check box is selected . This option ensures that during synchronization , Content that is no longer part of the upstream repository is deleted .
  7. Click on “ preservation Save”.

Repeat these steps , add to AppStream Repository and its application URL, for example , Make sure you use the latest official CentOS Mirror instead of it .

To perform an immediate synchronization , In your product window , Click on “ Sync now Sync Now”. The initial synchronization may take some time . You can start your “ Content Content >  sync Sync Status” View synchronization status .

After synchronization , You can “ host Hosts >  operating system Operating System” View new CentOS Stream operating system . Please feel free to edit the name and description to meet your requirements .

If you plan to use Ansible or Puppet And other configuration management software ,Foreman An operating system report is automatically created . You can “ management Administe >  Set up Settings >  Ignore operating system conditions Ignore facts for operating system” Turn off this option in . Renaming the operating system to match the name in the configuration management software is a good idea . for example , about Puppet, This will be “CentOS 8”.

Define the lifecycle environment of your infrastructure

The application lifecycle is Foreman A core concept of content management function . The life cycle of an application defines the state of a particular system and its software at a particular stage . for example , The life cycle of an application can be simple , You may only have one “ Development ” Phase and “ production ” Stage .Foreman Provides ways to customize each application lifecycle phase in a controlled manner , To fit your norms .

At this point , You must create your lifecycle environment path .

  1. stay Foreman In the web user interface , Navigate to “ Content Content >  Life cycle environment Lifecycle Environments”.
  2. Click on “ New environment path New Environment Path”, Start a new application lifecycle .
  3. stay “ name Name” Field , Enter a name for your environment .
  4. stay “ describe Description” Field , Enter a description of your environment .
  5. Click on “ preservation Save”.
  6. Add as many environment paths as you need . for example , You can create “dev”、“test”、“stage” and “production” Environmental Science . To add these environments , Click on “ Add a new environment ”, complete “ name Name” and “ describe Description” Field , And from “ Priority environment Prior Environment*” Select the previous environment from the list , So you can connect them in the order you want to use them .

Create and publish a content view

stay Foreman in ,“ Content view Content View” Is a snapshot of your repository at a specific point in time . The content view provides a mechanism to isolate the package version from the state you want to keep . The content view has many configurable features , You can use it to further refine . For the purposes of this tutorial , Let's keep it simple .

  1. stay Foreman In the web user interface , Navigate to “ Content Content >  Content view Content View”, And click the “ Create a new view Create New View”.
  2. stay “ name Name” Field , Enter a name for the view .Foreman It will be automatically completed according to the name you enter “ label Label” Field .
  3. stay “ describe Description” Field , Enter a description of the view .
  4. single click “ preservation Save” To create a content view .
  5. In the new content view , Click on “Yum Content Yum Contents >  Add Repository Add Repositories”, stay “ Repository selection Repository Selection” Area , Click on “ add to Add”. about BaseOS and Appstream The repository , Select the package you want to include , And then click “ Add Repository Add Repositories”.
  6. Click on “ Release a new version Publish New Version”, stay “ describe Description” Area , Enter information about the version to record changes .
  7. single click “ preservation Save”.

When you click “ Release a new version Publish New Version” when , You've created a snapshot of everything you've synced . This means that each server you subscribe to this content view will only access the package version in the content view related to this lifecycle environment .

Each new content view and subsequent versions will be published to the library environment first , Then you can spread it there to other environments .

Promote content across life cycle environments

If you have tested a new package , And make sure everything is stable , You can extend your content view to another lifecycle environment .

  1. Navigate to “ Content Content >  Content view Content Views”, Select the content view you want to promote .
  2. Click... In the content view “ edition Versions” label .
  3. Choose the version you want to promote , And in “ operation Action” In the bar , Click on “ Extension Promote”.
  4. Choose the environment where you want to promote content view , And click the “ Promotion version Promote Version”.
  5. Click again on the “ Extension Promote” Button . This time choose the lifecycle environment , for example ,“Test”, And then click “ Promotion version Promote Version”.
  6. Last , Click again on the “ Extension Promote” Button . for example , choice “Production” Environment and click “ Promotion version Promote Version”.

Servers assigned to this particular environment can now be extracted from an updated set of software packages .

Create an activation key

In order to CentOS Stream The server registers with the content you define in a specific lifecycle , You must create an activation key . The activation key is a secure way to share credentials with the server . This uses a method called “ Subscription manager subscription-manager Tools to subscribe to CentOS Stream The content of the server .

When you create the activation key , take CentOS Stream Add subscription to activation key .

  1. stay Foreman In the web user interface , Navigate to “ Content Content >  Activation key Activation keys”, And click the “ Create activation key Create Activation Key”.
  2. stay “ name Name” In the bar , Enter the name of the activation key .
  3. stay “ describe Description” In the bar , Enter a description of the activation key .
  4. from “ Environmental Science Environment” In the list , Select the environment to use .
  5. from “ Content view Content View” In the list , Select the content view you just created .
  6. Click on “ preservation Save”.

from Foreman Create a... In the managed content CentOS Stream host

Now everything is ready . As the content you create is included in the content view , And promote... Throughout the life cycle , You can now configure the host with exactly what you want to use , And subscribe to the updates you want them to receive .

To be in Foreman Create a host in , Please navigate to “ host > Create a host ”.

  1. stay “ name Name” Field , Enter a name for the host .
  2. single click “ organization Organization” and “ Location Location” tab , To ensure that the configuration environment is automatically set to the current environment .
  3. from “ Deployed in Deploy On” In the list , choice “ Bare metal Bare Metal”.
  4. single click “ operating system Operating System” tab .
  5. from “ framework Architectures” In the list , choice “x86_64”.
  6. from “ operating system Operating System” In the list , choice “CentOS_Stream 8”.
  7. Check “ Build a model Build Mode” box .
  8. about “ Media choice Media Selection”, choice “ Synchronized content Synced Content” To use your previously synced CentOS Stream Content .
  9. from “ Synchronized content Synced Content” In the list , Make sure to choose “CentOS Stream”.
  10. from “ Partition table Partition Table” In the list , For this demonstration , Choose the default “Kickstart”, But there are many options available .
  11. stay “Root password Root Password” In the bar , Enter a... For your new host root password .
  12. Click on “ Interface Interface” label , And click the “ edit Edit”, And add a “Mac Address Mac address”.
  13. Click on “ Parameters Parameters” label , And make sure to save it in a parameter that provides the activation key . without , Add an activation key .
  14. Click on “ Submit Submit” To save the host entry .

Now? , The new host is in build mode , That means when you open it , It will start installing the operating system .

If you navigate to “ host Hosts >  Content host Content Hosts”, You can see the subscriptions subscribed by your host 、 Full details of the lifecycle environment and content view .

This example is just for you in Foreman Manage and configure in CentOS Stream A small peek at the many options of content . If you want to know more about how to manage CentOS Stream edition , Control what your server can access , And details of controlling and protecting the stability of your infrastructure , Please check out    file . When all CentOS Stream When the content is under your control , You can create and register Centos Stream, Use only what you specify . More details about the equipment , Please see the    file . If you have any questions 、 Feedback or suggestions , You can    find Foreman Community .


author :  Topic selection :  translator :  proofreading :

This paper is written by    Original compilation ,  Honor roll out

Please bring the original link to reprint ,thank
Similar articles