在团800运维工作总结之cobbler自动装机


yum install cobbler httpd rsync tftp-server xinetd dhcp python-ctypyes cman pykickstart system-config-kickstarts

yum install cobbler-web

yum install koan

yum install debmirror

yum install syslinux


vim /etc/cobbler/settings

manage_dhcp: 1

manage_tftpd: 1

manage_rsync: 1

server: 192.168.10.202

next_server: 192.168.10.202

allow_dynamic_settings: 1


vim /etc/xinetd.d/rsync

disable= no


vim /etc/debmirror.conf

#@dists="sid";


#@arches="i386";


/etc/init.d/httpd start

/etc/init.d/xinted restart

/etc/init.d/cobblerd start


cobbler check


/etc/init.d/cobblerd restart

cobbler get-loaders


openssl passwd -1 -salt 'random-phrase-here' ‘*****'

$1$random-p$4zkWIb0YT4pmubJGMND1N.


vim /etc/cobbler/setttings

default_password_crypted: "$1$random-p$4zkWIb0YT4pmubJGMND1N."

pxe_just_once: 1



/etc/init.d/cobblerd restart

cobbler sync



/etc/cobbler/dhcpd.templates

subnet 192.168.10.0 netmask 255.255.255.0 {

     option routers             192.168.10.1;

     option domain-name-servers 192.168.10.202;

     option subnet-mask         255.255.255.0;

     range dynamic-bootp        192.168.10.250 192.168.10.254;

     filename                   "pxelinux.0";

     default-lease-time         21600;

     max-lease-time             43200;

     next-server                192.168.10.202;

}


/etc/cobbler/pxe/pxedefault.template

DEFAULT menu

PROMPT 0

MENU TITLE Cobbler | tuan800 cobbler

MENU MASTER PASSWD $1$random-p$4zkWIb0YT4pmubJGMND1N.  (hash是setting配置文件里设置的)

TIMEOUT 200

TOTALTIMEOUT 6000

ONTIMEOUT $pxe_timeout_profile


LABEL local

        MENU LABEL (local)

        MENU DEFAULT

        LOCALBOOT -1


$pxe_menu_items


MENU end



/etc/cobbler/pxe/pxeprofile.template

LABEL $profile_name

        MENU PASSWD

        kernel $kernel_path

        $menu_label

        $append_line

        ipappend 2




mount -o loop /root/rhel-server-6.3-x86_64-dvd.iso /home/rhel-6.3/


cobbler import --path=/home/rhel-6.3/ --name=rhel-6.3 --arch=x86_64


指定镜像用哪个ks文件

cobbler profile edit --name=rhel-6.3-x86_64 --kickstart=/var/lib/cobbler/kickstarts/sample.ks



命令

cobbler list    

-------------------

distros:

   rhel-6.3-x86_64


profiles:

   rhel-6.3-x86_64


systems:

   cobblertest01


repos:


images:


mgmtclasses:


packages:


files: 

--------------------


[root@localhost pxe]# cobbler system list

--------------------

   cobblertest01

---------------------


根据mac地址指定主机的ip地址 并注册到cobbler中,并指定做什么系统

cobbler system add --name=cobblertest01 --hostname=cobblertest1 --mac=52:54:00:67:35:B7 --n=em0 --ip-address=192.168.10.251 --subnet=255.255.255.0 --gateway=192.168.10.1 --static=1 --profile=rhel-6.3-x86_64 --interface-master=em0

cobbler system remove --name=cobblertest01   删除cobbler中注册的主机信息


添加一个镜像的步骤


1.mount -o loop /root/rhel-server-6.3-x86_64-dvd.iso /home/rhel-6.3/


2.cobbler import --path=/home/rhel-6.3/ --name=rhel-6.3 --arch=x86_64


3.cobbler profile edit --name=rhel-6.3-x86_64 --kickstart=/var/lib/cobbler/kickstarts/sample.ks


cobbler list



删除镜像

cobbler profile remove --name=rhel-6.3-x86_64


查看cobbler都加载了那些镜像

cobbler distro list


查看都有那些系统是用cobbler装的

cobbler system list


cobbler system add --name=cobblertest01 --hostname=cobblertest1 --mac=******************* --interface=em0 --ip-address=192.168.10.251 --subnet=255.255.255.0 --gateway=192.168.10.1 --static=1 --profile=rhel-6.3-x86_64 --interface-master=em0


删除之前装的系统 在cobbler里注册的信息

cobbler system remove --name=cobblertest01



cobbler system reboot --name=cobblertest-centos-01


客户端重新做系统

koan --server=192.168.10.202 -t 81 --list=profiles

koan --replace-self --server=192.168.10.202 -t 81 --profile=centos-6.5-x86_64


本文出自 “expect批量同步数据” 博客,谢绝转载!


注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
© 2014-2019 ITdaan.com 粤ICP备14056181号