Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the automatic deployment of Cobbler Operation and maintenance

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to realize the automatic deployment of Cobbler operation and maintenance? in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

I. description of parameters

Related configuration parameters:

II. Summary

In general, there are no major problems with the use of Cobbler under the RHT/Centos series version. The main function of Cobbler is to manage the changes of DHCP and Kickstart under one platform. The essence of Cobbler is that it enables the Kickstart configuration template, in which python code can be embedded.

This part of the technology, Cobbler is called: snippets

In the RHT/Centos series, the official has provided a lot of this code, basically just call it, but under Ubuntu is very painful, you have to develop your own.

The following is the relevant configuration path (default installation):

Main location of Cobbler configuration: / var/lib/cobbler/ (directory of actual operation and configuration)

Snippets code location: / var/lib/cobbler/snippets/

Kickstart template location: / var/lib/cobbler/kickstarts/

Installation source image location: / var/www/cobbler/ks_mirror/ (link it to the release directory of apache to make it easier for kickstart to download and install image files through http when working)

Third, the specific use process

1) Import installation source

A) prepare the installation CD (ISO)

Temporarily put it on: / www/os/CentOS-6.3-x86_64-bin-DVD1.iso

B) Mount ISO

Mount-o loop / www/os/CentOS-6.3-x86_64-bin-DVD1.iso / mnt/centos63-1

C) Import the installation source into Cobbler

Through this link, Cobbler will copy the installed image ISO to the source installation image directory: / var/www/cobbler/ks_mirror/

The operation commands are as follows:

Cobbler import-path=/mnt/centos63-1-name=centos6.3-arch=x86_64

Parameter description:

-- name defines a name for the installation source

-- arch specifies whether the installation source is 32-bit or 64-bit, ia64. Currently supported options are: x86 │ x86 64 │ ia64

Note: the * tag of this installation source is defined based on these two parameters.

After the import of this example is successful, the * tag of the installation source is: centos6.3-x86_64. If you repeat, the system will prompt you that the import failed.

For more usage, check the official documentation: man cobbler, and then look for the configuration of import. If you need more parameter customization, you can use another command: cobbler distro.

Related management commands:

/ / View the list of imported source libraries

Cobbler distro list

/ / View details of the imported installation source

Cobbler distro report-name centos6.3-x86_64

2) define Profile

The concept of Profile, which I understand as configuration grouping, allows you to specify services and configurations for a group of servers that they all need to install.

For example: specify the partition policy of the disk, specify the services to be installed, keyboard layout, default language, etc., all of these operations are actually achieved by assigning different kickstart configuration files in Profile. During the * import, the system assigns a default Profile to the installation source, which defines a KS file: / var/lib/cobbler/kickstarts/sample.ks. To meet the requirements of custom services, we need to define our own Profile and specify our own KS file. Of course, you can also need to customize multiple KS files.

Following the example above, I have imported an installation source: centos6.3-x86_64, so I need to define a Profile

The operation commands are as follows:

Cobbler profile add-name=centos6.3-x86_64-distro=centos6.3-x86_64-kickstart=/var/lib/cobbler/kickstarts/centos6.3-x86_64.ks

If this profile already exists, you need to modify it:

Cobbler profile edit-name=centos6.3-x86_64-distro=centos6.3-x86_64-kickstart=/var/lib/cobbler/kickstarts/centos6.3-x86_64.ks

Parameter description:

-- the name of name Profile (also cannot be repeated). In this case, our newly defined Profile is called centos6.3-x86_64.

-- the installation source ID associated with distro Profile (can be found through cobbler distro list)

-- kickstart configuration file associated with kickstart Profile (this file must be prepared in advance)

Related management commands:

/ / View profile details

Cobbler profile report-name centos6.3-x86_64

/ / find the corresponding KS file through profile

Ksfile=$ (cobbler profile report-- name centos6.3-x86_64 | grep-E'^ Kickstart' | head-n 1 | cut-d':'- f 2); cat $ksfile

3) prepare a custom kickstart configuration file (For Centos/RHEL)

Note: this is one of the key steps

Due to the different publishers of the operating systems that need to be installed, the writing requirements for KS files are various.

This article only discusses the KS configuration of the CentOs/RHEL series.

In addition: different versions of the operating system, there are some differences in KS, such as CentOS5, and CentOS6 are different, remember!

The documentation on the official website is here:

CentOS5 (this series is mostly available online): http://www.centos.org/docs/5/html/Installation_Guide-en-US/s1-kickstart2-options.html

For CentOS6 (few configuration cases can be seen): https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/s1-kickstart2-options.html

In addition, the KS file I tested myself has also been uploaded. Available for download:

Centos6.3 64-bit KS

Centos5.8 64-bit KS

In addition, Cobbler supports RHEL and CentOS very well, so many options that require special definition have corresponding snippets scripts.

It is recommended to look it up in the snippets directory before using it. You may already have it, otherwise you will consider developing your own snippets script.

The calling method in the KS file is as follows:

% post $SNIPPET ('post_install_network_config')

This line configuration invokes operations related to the network configuration (inside is a template that supports embedding python code)

There is an important configuration parameter in the ks file that defines how to download the source files for the system installation:

For example, the CentOS6 configuration file has this line: url-- url= http://192.168.100.1/cobbler/ks_mirror/centos6.3

These are actually the various installation packages in the previously imported installation source, and now specify how to access them.

4) customize the server on which the system needs to be installed

Description: the server network card must support PXE function

There are at least several customizations: network configuration, Hostname and so on.

Note: if it is not customized, after the network card is started through PXE, a menu will appear for people to choose which configuration to use (actually the name of Profile)

And each installation source has its own default KS file. After the expiration of the time, the default KS file will be specified for installation.

This article mainly discusses automated one-click deployment, so customization must be done.

The operation of this part is mainly realized through cobbler system.

The operation commands are as follows:

Cobbler system add-name=WebCache-3.167-- mac=00:24:E8:64:24:59-- ip-address=192.168.3.167-- subnet=255.255.255.0-- gateway=192.168.3.1-- interface=eth0-- static=1-- profile=centos6.3-x86_64-- dns-name=ywtest-3-167.test.com-- hostname=ywtest-3-167.test.com-- netboot-enabled=true-- name-servers= "192.168.3.1 202.106.196.115"

The above command defines a server as follows:

A) Server name (cannot be repeated): WebCache-3.167

Because this server is intended to be used for Web services, the ip address is 192.168.3.167. This format is easy to remember.

B) Network assigned network card device: eth0 MAC address: 00:24:E8:64:24:59

Note that this is required and is mainly based on it to distinguish different configurations

Similarly, this parameter is not allowed to be repeated (the same MAC can only match one custom configuration)

C) assigned IP: 192.168.3.167 subnet mask: 255.255.255.0 default gateway: 192.168.3.1 device name: eth0 assigned static IP

D) DNS service IP: 192.168.3.1 202.106.196.115 (configured on a case-by-case basis)

Multiple DNSIP can be added, spaced by spaces

E) specify a Profile: centos6.3-x86_64

This option automatically defines the installed system, installed services, and so on for this machine

The specific configuration can be obtained by viewing the actual defined KS file of profile.

F) specify hostname: ywtest-3-167.test.com

Cobbler can modify the hostname configuration of CentOS system according to this parameter.

G) Cobbler can be set to skip the second PXE startup after the installation of a new server (avoid repeated installation)

But if you need to force the installation, you need to use this parameter:-- netboot-enabled=true

Related operation commands:

/ / View customized list

Cobbler system list

/ / View the details of a customization

Cobbler system-name WebCache-3.167

More customization techniques:

A) customization of multiple network cards

Generally speaking, eth0 is configured by default. Of course, Cobbler also supports customization of multiple network cards.

It should be noted that there is no problem with this function under CentOS/RHEL. Cobbler can change these specific settings through snippets scripts to modify KS.

However, there is no corresponding snippets script for the same configuration under Ubuntu (in theory, it can be written by yourself), so it can only be implemented in other ways.

The operation commands are as follows:

Cobbler system edit-name WebCache-3.167-interface=eth0.10-static=1-ip=192.168.10.5-subnet=255.255.255.0 cobbler system edit-name WebCache-3.167-interface=eth2-static=1 ip=192.168.20.5-subnet=255.255.255.0

Through the above two sentences, you can add the alias of the network card eth0: eth0:10, and the configuration of another network card eth2.

B) delete the custom configuration of the network card

System edit-name= WebCache-3.167-interface=eth2-delete-interface

C) support network card bonding configuration

Cobbler system edit-name=WebCache-3.167-interface=eth0-mac=AA:BB:CC:DD:EE:00-interface-type=bond_slave-interface-master=bond0 cobbler system edit-name=WebCache-3.167-interface=eth2-mac=AA:BB:CC:DD:EE:01-interface-type=bond_slave-interface-master=bond0 cobbler system edit-name=WebCache-3.167-interface=bond0 interface-type=bond bonding-opts= "mode=active-backup miimon=100"-ip=192.168.3.167-subnet=255.255 .255.0-gateway=192.168.3.1-static=1

The above command is configured with a bonding whose members are: eth0,eth2

D) configure the network card of Bridge type

Cobbler system edit-name=WebCache-3.167-interface=eth3-mac=AA:BB:CC:DD:EE:00-interface-type=bridge_slave-interface-master=br0-static=1 cobbler system edit-name=WebCache-3.167-interface=br0-mac=AA:BB:CC:DD:EE:00 interface-type= "bridge"-static=1

The above statement is to configure a Bridge: br0, whose member is eth3

Because I do not want to configure the IP address for this bridge, I should add the parameter:-- static=1, otherwise the Bridge will be configured in DHCP mode in the actual configuration of the Cobbler.

For more tips, please refer to WIKI.

You can also refer to the MAN: man cobbler included with the software.

5) synchronize the changes made in the above steps

Because there are many components that need to be modified in the above steps (according to the cobbler configuration file), there will probably be:

A) Cobbler's own internal configuration

The configuration information of the above links will be recorded automatically.

B) Dhcp configuration (management of Dhcp functions needs to be enabled in the main configuration file)

It should be noted that if you are in Centos5, you will encounter problems, while Centos6 will not have problems.

The default Cobbler modifies / etc/dhcp/dhcpd.conf, but the configuration file under Centos5 is under / etc/

Therefore, you may need to modify dhcp's system startup script / etc/init.d/dhcpd

C) Tftp configuration (management of Tftp functions needs to be enabled in the main configuration file)

Because there is a customized configuration, Cobbler generates the corresponding configuration in the main configuration folder of tftp:

Suppose: the root directory of ftft is / tftpboot/

The configuration file generated by Cobbler will be placed under / tftpboot/pxelinux.cfg/

D) Bind configuration (management of DNS functions needs to be enabled in the main configuration file)

This part of the configuration was not opened in my test, so there was no test.

It is estimated that the main configuration file / etc/named.conf of Bind will be modified

The operation commands are as follows:

Cobbler sync

6) turn on the power, BOOT needs to automatically install the server

Generally connected to the power supply, through the PXE can complete the automatic installation, basically after 20-30 minutes, you can complete an installation.

IV. Addendum

1) about Apache and Cobbler

In my previous article (Cobbler- service installation), I already said that Apache and Cobbler are deeply integrated

Cobbler is mainly written in python, which uses the wsgi module of Apache to implement the interface of http.

Using this interface, you can do several things:

A provide http downloads for installation sources

B Cobbler's web management platform, which provides a graphical operation interface (I have not tested this part in depth, please check the relevant documents yourself)

/ / Cobbler web interface access address:

Http://192.168.100.1/cobbler_web/ (192.168.100.1 is the IP address for apache snooping)

C provides an API to query related configurations

For example:

/ / query profile details

Http://192.168.100.1/cblr/svc/op/ks/profile/centos6.3-x86_64

/ / query the customized configuration KS file

Http://192.168.100.1/cblr/svc/op/ks/system/WebCache-3.167

2) about wsgi

Installation method: yum-y install mod_wsgi

Related profile:

A) wsgi.conf: you can have apache start the wsgi module

Its content is an one-line configuration command:

LoadModule wsgi_module modules/mod_wsgi.so

B) mod_wsgi.so module core, developed according to apache components

This file needs to be placed in the module components directory of apache

C) cobbler.conf

This profile is the main core configuration

Assume that both apache and cobbler are installed by default

The file will exist at: / etc/httpd/conf.d/cobbler.conf

3) configuration check

/ / kickstart configuration check

Cobbler validateks

/ / single kickstart profile check

/ usr/bin/ksvalidator "http://192.168.100.1/cblr/svc/op/ks/profile/centos6.3-x86_64" / usr/bin/ksvalidator" http://192.168.100.1/cblr/svc/op/ks/system/WebCache-3.167"

4) set up and synchronize specific sources

A) add specific sources

Cobbler repo add-mirror= http://mirrors.ustc.edu.cn/epel/6/x86_64/-name=ustc-epel6-x86_64--arch=x86_64-breed=yum cobbler repo add-mirror= http://mirrors.ustc.edu.cn/epel/testing/6/x86_64/-name=ustc-epel6-x86_64-testing-arch=x86_64-breed=yum

B) assign a specific source to the profile

Cobbler profile edit-name= centos6.3-x86_64-repos= "epel6-x86_64 epel6-x86_64-testing"

C) need to synchronize epel source to local to test your network speed

Cobbler reposync cobbler reposync-tries=3-no-fail

6) modify the kernel startup parameters to ensure that there will be no prompts to select country, language and keyboard layout after the installation begins.

Cobbler profile edit-name=centos6.3-x86_64-distro=centos6.3-x86_64-kickstart=/var/lib/cobbler/kickstarts/centos6.3-x86_64.ks-kopts= "locale=en_US netcfg/choose_interface=auto console-setup/ask_detect=false keyboard-configuration/layoutcode=us"

This is the answer to the question on how to realize the automatic deployment of Cobbler operation and maintenance. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report