fixed some bugs in cobbler cookbooks as well as added some functionality in order to support centos

This commit is contained in:
Vladimir Kozhukalov 2012-06-29 18:38:38 +04:00
parent c635e7e6e6
commit 661221e2ce
7 changed files with 37 additions and 30 deletions

View File

@ -11,13 +11,15 @@ default["cobbler"]["repoaddr"] = default_conf[:server]
default["cobbler"]["ks_mirror_dir"] = "/var/www/cobbler/ks_mirror"
default["cobbler"]["preseed_dir"] = "/var/lib/cobbler/kickstarts"
default["cobbler"]["bootstrap_kernel"] = "/var/lib/mirror/bootstrap/linux"
default["cobbler"]["bootstrap_initrd"] = "/var/lib/mirror/bootstrap/initrd.gz"
default["cobbler"]["bootstrap_mnt"] = "/var/lib/mirror/bootstrap"
# default["cobbler"]["bootstrap_kernel"] = "/var/lib/mirror/bootstrap/linux"
# default["cobbler"]["bootstrap_initrd"] = "/var/lib/mirror/bootstrap/initrd.gz"
default["cobbler"]["precise-x86_64_iso"] = "/var/lib/mirror/netinst/precise-x86_64.iso"
default["cobbler"]["precise-x86_64_mnt"] = "/var/lib/mirror/netinst/precise-x86_64"
default["cobbler"]["centos-6.2-x86_64_iso"] = "/var/lib/mirror/netinst/CentOS-6.2-x86_64-netinstall.iso"
default["cobbler"]["centos-6.2-x86_64_mnt"] = "/var/lib/mirror/netinst/centos-6.2-x86_64"

View File

@ -1,4 +1,4 @@
define :distro do
define :cobbler_distro do
name = params[:name]
kernel = params[:kernel]
initrd = params[:initrd]

View File

@ -1,4 +1,4 @@
define :profile, :menu => true, :kickstart => nil do
define :cobbler_profile, :menu => true, :kickstart => nil do
name = params[:name]
kopts = params[:kopts]
distro = params[:distro]

View File

@ -1,4 +1,4 @@
define :system, :netboot => true do
define :cobbler_system, :netboot => true do
name = params[:name]
profile = params[:profile]
if params[:netboot] == true
@ -7,13 +7,13 @@ define :system, :netboot => true do
netboot = "False"
end
execute "add_system_#{default}" do
execute "add_system_#{name}" do
command "cobbler system add \
--name=#{name} \
--profile=#{profile} \
--netboot-enabled=#{netboot}"
action :run
only_if "test -z `cobbler profile find --name #{name}`"
only_if "test -z `cobbler system find --name #{name}`"
end
execute "edit_system_#{name}" do
@ -22,7 +22,7 @@ define :system, :netboot => true do
--profile=#{profile} \
--netboot-enabled=#{netboot}"
action :run
only_if "test ! -z `cobbler profile find --name #{name}`"
only_if "test ! -z `cobbler system find --name #{name}`"
end
end

View File

@ -2,25 +2,29 @@
# installed into node.cobbler.bootstrap_kernel and
# node.cobbler.bootstrap_initrd correspondently
directory "#{node.cobbler.ks_mirror_dir}/bootstrap" do
owner "root"
group "root"
mode "0755"
recursive true
action :create
link "#{node.cobbler.ks_mirror_dir}/bootstrap" do
to "#{node["cobbler"]["bootstrap_mnt"]}"
end
link "#{node.cobbler.ks_mirror_dir}/bootstrap/linux" do
to "#{node.cobbler.bootstrap_kernel}"
link_type :hard
end
# directory "#{node.cobbler.ks_mirror_dir}/bootstrap" do
# owner "root"
# group "root"
# mode "0755"
# recursive true
# action :create
# end
link "#{node.cobbler.ks_mirror_dir}/bootstrap/initrd.gz" do
to "#{node.cobbler.bootstrap_initrd}"
link_type :hard
end
# link "#{node.cobbler.ks_mirror_dir}/bootstrap/linux" do
# to "#{node.cobbler.bootstrap_kernel}"
# link_type :hard
# end
distro "bootstrap" do
# link "#{node.cobbler.ks_mirror_dir}/bootstrap/initrd.gz" do
# to "#{node.cobbler.bootstrap_initrd}"
# link_type :hard
# end
cobbler_distro "bootstrap" do
kernel "#{node.cobbler.ks_mirror_dir}/bootstrap/linux"
initrd "#{node.cobbler.ks_mirror_dir}/bootstrap/initrd.gz"
arch "x86_64"
@ -28,13 +32,13 @@ distro "bootstrap" do
osversion "precise"
end
profile "bootstrap" do
cobbler_profile "bootstrap" do
kopts "root=/dev/ram0 rw ramdisk_size=614400"
distro "bootstrap"
menu true
end
system "default" do
cobbler_system "default" do
profile "bootstrap"
netboot true
end

View File

@ -78,5 +78,5 @@ end
include_recipe "cobbler::bootstrap"
include_recipe "cobbler::precise-x86_64"
include_recipe "cobbler::centos-6.2-x86_64"

View File

@ -19,6 +19,7 @@ directory "#{node["cobbler"]["precise-x86_64_mnt"]}" do
owner "root"
group "root"
mode "0755"
not_if "test -d #{node["cobbler"]["precise-x86_64_mnt"]}"
end
mount "#{node["cobbler"]["precise-x86_64_mnt"]}" do
@ -27,10 +28,10 @@ mount "#{node["cobbler"]["precise-x86_64_mnt"]}" do
end
link "#{node.cobbler.ks_mirror_dir}/precise-x86_64" do
to #{node["cobbler"]["precise-x86_64_mnt"]}
to "#{node["cobbler"]["precise-x86_64_mnt"]}"
end
distro "precise-x86_64" do
cobbler_distro "precise-x86_64" do
kernel "#{node.cobbler.ks_mirror_dir}/precise-x86_64/linux"
initrd "#{node.cobbler.ks_mirror_dir}/precise-x86_64/initrd.gz"
arch "x86_64"
@ -38,7 +39,7 @@ distro "precise-x86_64" do
osversion "precise"
end
profile "precise-x86_64" do
cobbler_profile "precise-x86_64" do
kickstart "#{node.cobbler.preseed_dir}/precise-x86_64.seed"
kopts "priority=critical locale=en_US netcfg/choose_interface=auto"
distro "precise-x86_64"