cobbler+koan自动重装客户机

   koan是kickstart-over-a-network的缩写,它是cobbler的客户端帮助程序,koan允许你通过网络提供虚拟机,也允许你重装已经存在的客户端。当运行时,koan会从远端的cobbler server获取安装信息,然后根据获取的安装信息进行安装。

koan的用法如下:
koan --server=cobbler-server  
     [--list=type] [--virt|--replace-self|--display] 
     [--profile=name] [--system=name] [--image=name]
     [--add-reinstall-entry] [--virt-name=name] [--virt-path=path] 
     [--virt-type=type] [--nogfx] [--static-interface=name] [--kexec]
显示cobbler server上的各种对象信息:
   koan --server=cobbler.example.org --list=profiles
   koan --server=cobbler.example.org --list=systems
   koan --server=cobbler.example.org --list=images
显示详细的对象信息:
   koan --server=cobbler.example.org --display --profile=name
   koan --server=cobbler.example.org --display --system=name
   koan --server=cobbler.example.org --display --image=name
使用--replace-self参数可以使你在下次重启客户机的时候重新安装客户机
   koan --server=cobbler.example.org --replace-self --profile=name
   koan --server=cobbler.example.org --replace-self --system=name
使用--update-config可以更新根据cobbler更新系统配置文件
   koan --server=cobbler.example.org --update-config
使用--summary参数可以打印配置运行时的状态

koan还可以使用--virt参数安装虚拟机
   koan --server=cobbler.example.org --virt --profile=name
   koan --server=cobbler.example.org --virt --system=name
   koan --server=cobbler.example.org --virt --image=name
    还有一些参数可以配合--virt使用:
   --virt-name   name of virtual machine to create testmachine
   --virt-type    forces usage of qemu/xen/vmware qemu
   --virt-bridge   name of bridge device virbr0
   --virt-path   overwrite this disk partition /dev/sda4
   --virt-path   use this directory /opt/myimages
   --virt-path  use this existing LVM volume VolGroup00

   --nogfx  do not use VNC graphics 

实验环境还是上一章的环境,就把ubuntu12.04客户机使用koan一遍,可以在客户机上先安装koan客户端看看:

apt-get install koan
A 查看服务端有哪些profiles ( koan --server=10.1.6.234 --list=profiles )
root@ubuntu12:~# koan --server=10.1.6.234 --list=profiles
debian6
CentOS6.3-i386
ubuntu12.04-x86_64
CentOS6.3-x86_64
ubuntu12.10-x86_64
B 查看具体的信息 ( koan --server=10.1.6.234 --display  --profile=ubuntu12.04-x86_64)
root@ubuntu12:~#koan --server=10.1.6.234 --display  --profile=ubuntu12.04-x86_64
    install_tree: http://10.1.6.234/cblr/ks_mirror/ubuntu12.04
                name  : ubuntu12.04-x86_64
              distro  : ubuntu12.04-x86_64
           kickstart  : http://10.1.6.234/cblr/svc/op/ks/profile/ubuntu12.04-x86_64
             ks_meta  : tree=http://@@http_server@@/cblr/ks_mirror/ubuntu12.04 
        install_tree  : http://10.1.6.234/cblr/ks_mirror/ubuntu12.04
              kernel  : /var/www/cobbler/ks_mirror/ubuntu12.04/install/netboot/ubuntu-installer/amd64/linux
              initrd  : /var/www/cobbler/ks_mirror/ubuntu12.04/install/netboot/ubuntu-installer/amd64/initrd.gz
      kernel_options  : ksdevice=link lang= url=http://10.1.6.234/cblr/svc/op/ks/profile/ubuntu12.04-x86_64 auto priority=critical locale=en_US text 
               repos  : 
            virt_ram  : 512
    virt_disk_driver  : raw
           virt_type  : qemu
           virt_path  : 
      virt_auto_boot  : 1
C 设置在下次重启后安装
root@ubuntu12:~#koan --server=10.1.6.234 --replace-self --profile=ubuntu12.04-x86_64
install_tree: http://10.1.6.234/cblr/ks_mirror/ubuntu12.04
downloading initrd initrd.gz to /boot/initrd.gz
url=http://10.1.6.234/cobbler/images/ubuntu12.04-x86_64/initrd.gz
- reading URL: http://10.1.6.234/cobbler/images/ubuntu12.04-x86_64/initrd.gz
downloading kernel linux to /boot/linux
url=http://10.1.6.234/cobbler/images/ubuntu12.04-x86_64/linux
- reading URL: http://10.1.6.234/cobbler/images/ubuntu12.04-x86_64/linux
- setting grub2 default entry
- ['update-grub']
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.2.0-23-generic
Found initrd image: /boot/initrd.img-3.2.0-23-generic
Found memtest86+ image: /boot/memtest86+.bin
done
- reboot to apply changes
D reboot客户机,则在启动后回自动根据profile指定的配置重装该客户机。


转载于:https://my.oschina.net/guol/blog/114569

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值