November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Linux operation and maintenance of automated tools Cobbler

Linux operation and maintenance of automated tools Cobbler

About operating system installation automation, the earlier we use RedHat launched Kickstart to batch install the operating system, in recent years, RedHat has introduced a Cobbler.

Cobbler development using Python, compact and lightweight, able to complete the installation of the system, and even manage some services. (Known as a tool cobbler can learn)

Cobbler supports command line management, web interface management, but also provides an API interface to open the second method.

## Close SELinux, iptables! ! !

A supporting environment installation

yum -y install epel-release

yum -y install cobbler httpd rsync tftp-server xinetd dhcp pykickstart fence-agents

vim /etc/xinetd.d/tftp

service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}

vim /etc/xinetd.d/rsync

service rsync
{
disable = no
flags = IPv6
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = –daemon
log_on_failure += USERID
}

vim /etc/httpd/conf

ServerName 127.0.0.1:80

openssl passwd -1 -salt ‘random-phrase-here’ ‘test123’
$1$random-p$mzxQ/Sx848sXgvfwJCoZM0

vim /etc/cobbler/settings

manage_dhcp: 1

manage_tftpd: 1

manage_rsync: 1

next_server: 192.168.1.10

server: 192.168.1.10

default_password_crypted: “$1$random-p$mzxQ/Sx848sXgvfwJCoZM0″

vim /etc/cobbler/dhcp.template

subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.2;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.1.100 192.168.1.120;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;

chkconfig –add httpd
chkconfig –add xinetd
chkconfig –add dhcpd
chkconfig –add cobblerd
service httpd start
service xinetd start
service dhcpd start
service cobblerd start

cobbler check

The following are potential configuration items that you may want to fix:

1 : service dhcpd is not running
2 : debmirror package is not installed, it will be required to manage debian deployments and repositories

Restart cobblerd and then run ‘cobbler sync’ to apply changes.

cobbler sync
task started: 2015-05-27_010456_sync
task started (id=Sync, time=Wed May 27 01:04:56 2015)
running pre-sync triggers
cleaning trees
mkdir: /var/lib/tftpboot/pxelinux.cfg
mkdir: /var/lib/tftpboot/grub
mkdir: /var/lib/tftpboot/s390x
mkdir: /var/lib/tftpboot/ppc
mkdir: /var/lib/tftpboot/etc
removing: /var/lib/tftpboot/grub/images
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
trying hardlink /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32
trying hardlink /var/lib/cobbler/loaders/yaboot -> /var/lib/tftpboot/yaboot
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
copying distros to tftpboot
copying images
generating PXE configuration files
generating PXE menu structure
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
rendering TFTPD files
generating /etc/xinetd.d/tftp
cleaning link caches
rendering Rsync files
running post-sync triggers
running python triggers from /var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
running: dhcpd -t -q
received on stdout:
received on stderr:
running: service dhcpd restart
received on stdout: dhcpd?

received on stderr:
running shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***

service xinetd restart
service cobblerd restart

mount /dev/cdrom /mnt/
cobbler import –path=/mnt/ –arch=x86_64 –name=CentOS-6.6-minimal

cobbler list
distros:
Centos-6.6-minimal-x86_64

profiles:
Centos-6.6-minimal-x86_64

systems:

repos:

images:

mgmtclasses:

packages:

files:

ks

shell > vim /var/lib/cobbler/kickstarts/Centos-6.6_minimal-x86_64.ks

# platform=x86, AMD64, Intel EM64T
# version=DEVEL
# Firewall configuration
firewall –disabled
# Install OS instead of upgrade
install
# Use network installation
url –url=”http://192.168.214.10/cobbler/ks_mirror/Centos-6.6-minimal-x84_64/”
# Root password
rootpw –iscrypted $1$hk0MvN4A$Dz.sYvyDjac1.cMVTk9270
# System authorization information
auth –useshadow –passalgo=sha512
# Use text mode install
text
# System keyboard
keyboard us
# System language
lang eng_US
# SELinux configuration
selinux –disabled
# Do not configure the X Window System
skipx
# Installation logging level
logging –level=info
# Reboot after installation
reboot
# System timezone
timezone –isUtc Asia/Singapore
# Network information
network –bootproto=dhcp –device=eth0 –onboot=on
# System bootloader configuration
bootloader –location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart –all –initlabel
# Disk partitioning information
part /boot –fstype=”ext4″ –size=200
part swap –fstype=”swap” –size=1024
part / –fstype=”ext4″ –grow –size=1

system-config-kickstart ks

ks

shell > cobbler distro list
Centos-6.6-minimal-x86_64

shell > cobbler profile report –name Centos-6.6-minimal-x86_64
Name : Centos-6.6-minimal-x86_64
TFTP Boot Files : {}
Comment :
DHCP Tag : default
Distribution : Centos-6.6-minimal-x86_64
Enable gPXE? : 0
Enable PXE Menu? : 1
Fetchable Files : {}
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart : /var/lib/cobbler/kickstarts/sample_end.ks
Kickstart Metadata : {}
Management Classes : []
Management Parameters : <>
Name Servers : []
Name Servers Search Path : []
Owners : [‘admin’]
Parent Profile :
Proxy :
Red Hat Management Key : <>
Red Hat Management Server : <>
Repos : []
Server Override : <>
Template Files : {}
Virt Auto Boot : 1
Virt Bridge : xenbr0
Virt CPUs : 1
Virt Disk Driver Type : raw
Virt File Size(GB) : 5
Virt Path :
Virt RAM (MB) : 512
Virt Type : kvm

/var/lib/cobbler/kickstarts/sample_end.ks

shell > cobbler profile add –name=Centos-6.6-minimal –distro=Centos-6.6-minimal-x86_64 –kickstart=/var/lib/cobbler/kickstarts/Centos-6.6_minimal-x86_64.ks

shell > cobbler profile report –name Centos-6.6-minimal
Name : Centos-6.6-minimal
TFTP Boot Files : {}
Comment :
DHCP Tag : default
Distribution : Centos-6.6-minimal-x86_64
Enable gPXE? : 0
Enable PXE Menu? : 1
Fetchable Files : {}
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart : /var/lib/cobbler/kickstarts/Centos-6.6_minimal-x86_64.ks
Kickstart Metadata : {}
Management Classes : []
Management Parameters : <>
Name Servers : []
Name Servers Search Path : []
Owners : [‘admin’]
Parent Profile :
Proxy :
Red Hat Management Key : <>
Red Hat Management Server : <>
Repos : []
Server Override : <>
Template Files : {}
Virt Auto Boot : 1
Virt Bridge : xenbr0
Virt CPUs : 1
Virt Disk Driver Type : raw
Virt File Size(GB) : 5
Virt Path :
Virt RAM (MB) : 512
Virt Type : xenpv

shell > cobbler –help
usage
=====
cobbler
[add|edit|copy|getks*|list|remove|rename|report] [options|–help]
cobbler [options|–help]

shell > cobbler profile –help
usage
=====
cobbler profile add
cobbler profile copy
cobbler profile dumpvars
cobbler profile edit
cobbler profile find
cobbler profile getks
cobbler profile list
cobbler profile remove
cobbler profile rename
cobbler profile report

shell > cobbler sync

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>