1.4 Cobbler基础配置

    xiaoxiao2024-04-08  112

    任何修改后,重新同步cobbler配置,配置生效

    cobbler sync

    导入安装镜像

    挂载光盘

    mount -t iso9660 -o loop /data/share_iso/Centos/CentOS-6.8-x86_64-bin-DVD/CentOS-6.8-x86_64-bin-DVD1.iso /mnt/

    挂载Centos 6.8光盘镜像到/mnt目录下,导入

    cobbler import --name=Centos-6.8 --path=/mnt/ --arch=x86_64

    挂载Centos 7.3光盘镜像到/mnt目录下,导入

    cobbler import --name=Centos-7.3 --path=/mnt/ --arch=x86_64

    挂载ESXI 5.5光盘镜像到/mnt目录下,导入

    cobbler import --path=/mnt/ --name=ESXI-5.5.0 --arch=x86_64

    查看distro配置

    cobbler distro report

    定义自动安装的应答文件,文件放到/var/lib/cobbler/kickstarts/目录下

    Cobbler通过读取该文件,执行相关安装步骤请查看1.5 Cobbler 配置文件

    为可用镜像配置默认ks文件

    Centos 6.8

    cobbler profile edit --name=Centos-6.8-x86_64 --kickstart=/var/lib/cobbler/kickstarts/Centos-6.8-x86_64.cfg

    Centos 7.3

    cobbler profile edit --name=Centos-7.3-x86_64 --kickstart=/var/lib/cobbler/kickstarts/Centos-7.3-x86_64.cfg

    ESXI 5.5

    cobbler profile edit --name=ESXI-5.5.0-x86_64 --kickstart=/var/lib/cobbler/kickstarts/esxi5.5.cfg

    调整网卡内核参数(标准化,名称统一)

    Centos 7.3

    cobbler profile edit --name=Centos-7.3-x86_64 --kopts='net.ifnames=0 biosdevname=0'

    查看profile配置

    cobbler profile report

    建立本地yum源

    Centos 6.8

    cobbler repo add --name=Centos-6.8-x86_64-os --mirror=https://mirrors.aliyun.com/centos/6.8/os/x86_64/ --arch=x86_64 --breed=wget cobbler repo add --name=Centos-6.8-x86_64-updates --mirror=https://mirrors.aliyun.com/centos/6.8/updates/x86_64/ --arch=x86_64 --breed=wget cobbler repo add --name=Centos-6.8-x86_64-extras --mirror=https://mirrors.aliyun.com/centos/6.8/extras/x86_64/ --arch=x86_64 --breed=wget cobbler repo add --name=Centos-6-epel-x86_64 --mirror=https://mirrors.aliyun.com/epel/6/x86_64/ --arch=x86_64 --breed=wget cobbler repo add --name=zabbix3.0-Centos6 --mirror=http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/ --arch=x86_64 --breed=wget cobbler repo add --name=Centos-6.8-x86_64-gfs --mirror=https://mirrors.aliyun.com/centos/6.8/storage/x86_64/gluster-3.10/ --arch=x86_64 --breed=wget cobbler repo add --name=Centos-6.8-x86_64-cr --mirror=https://mirrors.aliyun.com/centos/6.8/cr/x86_64/ --arch=x86_64 --breed=wget

    Centos 7.3

    cobbler repo add --name=Centos-7.3-x86_64-os --mirror=https://mirrors.aliyun.com/centos/7.3.1611/os/x86_64/ --arch=x86_64 --breed=wget cobbler repo add --name=Centos-7.3-x86_64-updates --mirror=https://mirrors.aliyun.com/centos/7.3.1611/updates/x86_64/ --arch=x86_64 --breed=wget cobbler repo add --name=Centos-7.3-x86_64-extras --mirror=https://mirrors.aliyun.com/centos/7.3.1611/extras/x86_64/ --arch=x86_64 --breed=wget cobbler repo add --name=Centos-7-epel-x86_64 --mirror=https://mirrors.aliyun.com/epel/7/x86_64/ --arch=x86_64 --breed=wget cobbler repo add --name=Centos-7.3-x86_64-cloud-l --mirror=https://mirrors.aliyun.com/centos/7.3.1611/cloud/x86_64/openstack-liberty/ --arch=x86_64 --breed=wget cobbler repo add --name=Centos-7.3-x86_64-gfs --mirror=https://mirrors.aliyun.com/centos/7.3.1611/storage/x86_64/gluster-3.10/ --arch=x86_64 --breed=wget cobbler repo add --name=zabbix3.0-Centos7 --mirror=http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/ --arch=x86_64 --breed=wget

    查看repo配置

    cobbler repo report

    执行同步任务

    cobbler reposync

    错误一例:Exception occured: Exception value: 'cobbler reposync failed'

    解决方法1: 把--breed=yum更换为rsync或wget

    建立任务计划,每周六同步一次

    echo "0 23 * * 6 /usr/bin/cobbler reposync >> /app/log/cobbler.log 2>&1" >> /var/spool/cron/root

    重启CronCentos 6.8

    /etc/init.d/crond restart

    Centos 7.3

    systemctl restart crond

    为镜像配置本队YUM源

    Centos 6.8

    cobbler profile edit --name=Centos-6.8-x86_64 --repos="Centos-6-epel-x86_64 Centos-6.8-x86_64-extras Centos-6.8-x86_64-os Centos-6.8-x86_64-updates Centos-6.8-x86_64-cr Centos-6.8-x86_64-gfs zabbix3.0-Centos6"

    Centos 7.3

    cobbler profile edit --name=Centos-7.3-x86_64 --repos="Centos-7.3-x86_64-os Centos-7.3-x86_64-updates Centos-7.3-x86_64-extras Centos-7-epel-x86_64 Centos-7.3-x86_64-cloud-l Centos-7.3-x86_64-gfs zabbix3.0-Centos7"

    根据MAC地址零交互安装

    创建一个新的自定义安装

    cobbler system add --name=odb01.prod.ding --mac=00:0c:29:34:58:f1 --profile=Centos-6.8-x86_64 --ip-address=192.168.0.20 --subnet=255.255.255.0 --gateway=192.168.0.1 --interface=eth0 --static=1 --hostname=odb01.prod.ding --name-servers="114.114.114.114"

    修改自定义安装(name不可修改)

    cobbler system edit --name=odb01.prod.ding --mac=00:0c:29:34:58:f1 --profile=Centos-6.8-x86_64 --ip-address=192.168.0.20 --subnet=255.255.255.0 --gateway=192.168.0.1 --interface=eth0 --static=1 --hostname=odb01.prod.ding --name-servers="114.114.114.114"

    查看system配置

    cobbler system report

    修改展示页面内容

    [root@Centos-souce kickstarts]# cat /etc/cobbler/pxe/pxedefault.template DEFAULT menu PROMPT 0 MENU TITLE Cobbler | 系统自动化部署 TIMEOUT 200 TOTALTIMEOUT 6000 ONTIMEOUT $pxe_timeout_profile LABEL local MENU LABEL (local) MENU DEFAULT LOCALBOOT -1 $pxe_menu_items MENU end

    自动重装系统(注意:客户机配置)

    问题:虽然可以重装系统,但是不能设置IP、DNS、主机名解决:

    重装时候,生成专门为这台机器使用的一次性系统profile,用完即删将自定义操作交由saltstack或者ansible来做,但是IP地址怎么分配呢?通过dell的IDRAC等远程管理卡的远程界面,手工PXE启动(个人推荐)

    安装epel源,安装koan

    yum install koan -y

    获取Cobbler服务器上的可用系统列表

    [root@openstack ~]# koan --server=192.168.0.232 --list=profiles - looking for Cobbler at http://192.168.0.232:80/cobbler_api Centos-7.3-x86_64

    选择要重装的系统,执行安装命令

    koan --replace-self --server=192.168.0.232 --profile=Centos-7.3-x886_64

    1.2.3 Cobbler WEB配置

    https://192.168.0.232/cobbler_web 相关资源:敏捷开发V1.0.pptx
    最新回复(0)