cobbler関係コマンドメモ

今日は cobbler 関連のコマンドを自分の備忘としてメモです。

設定のチェック


設定のチェックは「cobbler check」


問題があれば、該当箇所のメッセージが出力されるので、そこを直すだけ。楽ですね。

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

1 : service dhcpd is not running

Restart cobblerd and then run 'cobbler sync' to apply changes.


何も無ければこんな感じです。

# cobbler check
No configuration problems found.  All systems go.

設定の再読み込み


何か変えたらとりあえず「cobbler sync」が良さそうです。
下は自分が作った環境で発行してみた結果です。

# cobbler sync
task started: 2010-12-29_130254_sync
task started (id=Sync, time=Wed Dec 29 13:02:54 2010)
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/CentOS5-i386
removing: /var/www/cobbler/images/CentOS5-xen-i386
removing: /tftpboot/pxelinux.cfg/default
removing: /tftpboot/images/CentOS5-i386
removing: /tftpboot/images/CentOS5-xen-i386
removing: /tftpboot/s390x/profile_list
copying bootloaders
copying distros
copying files for distro: CentOS5-xen-i386
trying hardlink /var/www/cobbler/ks_mirror/CentOS5/images/xen/vmlinuz -> /tftpboot/images/CentOS5-xen-i386/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/CentOS5/images/xen/initrd.img -> /tftpboot/images/CentOS5-xen-i386/initrd.img
trying hardlink /var/www/cobbler/ks_mirror/CentOS5/images/xen/vmlinuz -> /var/www/cobbler/images/CentOS5-xen-i386/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/CentOS5/images/xen/initrd.img -> /var/www/cobbler/images/CentOS5-xen-i386/initrd.img
copying files for distro: CentOS5-i386
trying hardlink /var/www/cobbler/ks_mirror/CentOS5/images/pxeboot/vmlinuz -> /tftpboot/images/CentOS5-i386/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/CentOS5/images/pxeboot/initrd.img -> /tftpboot/images/CentOS5-i386/initrd.img
trying hardlink /var/www/cobbler/ks_mirror/CentOS5/images/pxeboot/vmlinuz -> /var/www/cobbler/images/CentOS5-i386/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/CentOS5/images/pxeboot/initrd.img -> /var/www/cobbler/images/CentOS5-i386/initrd.img
copying images
generating PXE configuration files
rendering DHCP files
generating /etc/dhcpd.conf
rendering Rsync files
generating PXE menu structure
running post-sync triggers
running: dhcpd -t -q
returned: 0
running: /etc/rc.d/init.d/dhcpd restart
dhcpd を停止中: [  OK  ]
dhcpd を起動中: [  OK  ]
returned: 0
*** TASK COMPLETE ***

設定一覧の表示

簡単に表示するなら、「cobbler list」

# cobbler list
distros:
   CentOS5-i386
   CentOS5-xen-i386

profiles:
   CentOS5-i386
   CentOS5-xen-i386

systems:

repos:

images:


もう少し詳細に見たい場合は「cobbler report」

# cobbler report
distros:
==========
Name                           : CentOS5-xen-i386
Architecture                   : i386
Breed                          : redhat
Comment                        : rhel5.5
Initrd                         : /var/www/cobbler/ks_mirror/CentOS5/images/xen/initrd.img
Kernel                         : /var/www/cobbler/ks_mirror/CentOS5/images/xen/vmlinuz
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart Metadata             : {'tree': 'http://@@http_server@@/cblr/links/CentOS5-xen-i386'}
Management Classes             : []
OS Version                     : rhel5
Owners                         : ['admin']
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Template Files                 : {}

Name                           : CentOS5-i386
Architecture                   : i386
Breed                          : redhat
Comment                        : rhel5.5
Initrd                         : /var/www/cobbler/ks_mirror/CentOS5/images/pxeboot/initrd.img
Kernel                         : /var/www/cobbler/ks_mirror/CentOS5/images/pxeboot/vmlinuz
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart Metadata             : {'tree': 'http://@@http_server@@/cblr/links/CentOS5-i386'}
Management Classes             : []
OS Version                     : rhel5
Owners                         : ['admin']
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Template Files                 : {}


profiles:
==========
Name                           : CentOS5-xen-i386
Comment                        : 
DHCP Tag                       : default
Distribution                   : CentOS5-xen-i386
Enable PXE Menu?               : 1
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart                      : /var/lib/cobbler/kickstarts/sample.ks
Kickstart Metadata             : {}
Management Classes             : []
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : ['admin']
Parent Profile                 : 
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Repos                          : []
Server Override                : <<inherit>>
Template Files                 : {}
Virt Auto Boot                 : 1
Virt Bridge                    : xenbr0
Virt CPUs                      : 1
Virt File Size(GB)             : 5
Virt Path                      : 
Virt RAM (MB)                  : 512
Virt Type                      : xenpv

Name                           : CentOS5-i386
Comment                        : 
DHCP Tag                       : default
Distribution                   : CentOS5-i386
Enable PXE Menu?               : 1
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart                      : /var/lib/cobbler/kickstarts/sample.ks
Kickstart Metadata             : {}
Management Classes             : []
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : ['admin']
Parent Profile                 : 
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Repos                          : []
Server Override                : <<inherit>>
Template Files                 : {}
Virt Auto Boot                 : 1
Virt Bridge                    : xenbr0
Virt CPUs                      : 1
Virt File Size(GB)             : 5
Virt Path                      : 
Virt RAM (MB)                  : 512
Virt Type                      : qemu


systems:
==========

repos:
==========

images:
==========


「cobbler status」で実行結果が見られるようですね。

# cobbler status
ip             |target              |start            |state            
xxx.xxx.xxx.xxx |profile:CentOS5-i386|Sun Dec 19 23:33:12 2010|finished         
xxx.xxx.xxx.xxx |profile:CentOS5-i386|Sat Dec 18 16:23:09 2010|finished 

データのインポート

「cobbler import」でローカルメディアを使ったインポートが出来ます

# cobbler import --path=/mnt --name=CentOS5
task started: 2010-12-29_142411_import
task started (id=Media import, time=Wed Dec 29 14:24:11 2010)
running: rsync -a  '/mnt/' /var/www/cobbler/ks_mirror/CentOS5 --exclude-from=/etc/cobbler/rsync.exclude --progress
building file list ... 
2772 files to consider
(略)
Saving Primary metadata
Saving file lists metadata
Saving other metadata
returned: 0
associating kickstarts
scanning /var/www/cobbler/ks_mirror/CentOS5/images/xen for distro signature
scanning /var/www/cobbler/ks_mirror/CentOS5/images for distro signature
scanning /var/www/cobbler/ks_mirror/CentOS5 for distro signature
found content (breed=redhat) at /v
scanning /var/www/cobbler/ks_mirror/CentOS5/images/pxeboot for distro signature
scanning /var/www/cobbler/ks_mirror/CentOS5/images for distro signature
scanning /var/www/cobbler/ks_mirror/CentOS5 for distro signature
found content (breed=redhat) at /v
*** TASK COMPLETE ***

エントリの操作

追加・・・「cobbler add」
削除・・・「cobbler remove」
複製・・・「cobbler copy」
名前変更・・・「cobbler rename」
編集・・・「cobbler edit」

です。


実行例をいくつか。

# cobbler distro rename --name=CentOS5-i386 --newname=CentOS5-2-i386
# cobbler distro copy --name=CentOS5-i386 --newname=CentOS5-2-i386

# cobbler profile copy --name=CentOS5-i386 --newname=CentOS5-2-i386
# cobbler profile edit --name=CentOS5-2-i386 --kickstart=/var/lib/cobbler/kickstarts/centos5.ks

# cobbler repo add --mirror=http://ftp.jaist.ac.jp/pub/Linux/CentOS/5/ --name=CentOS5-i386
# cobbler repo remove --name=CentOS5-i386

# cobbler system add --name=centos5-pxe-test --profile=CentOS5-2-i386 --mac=XX:XX:XX:XX:XX:XX:XX


今日はこんな所で。