fixed some points in cobbler cookbook

This commit is contained in:
Vladimir Kozhukalov 2012-07-06 17:15:34 +04:00
parent 20a2de3ef1
commit 97e6b3141b
5 changed files with 64 additions and 0 deletions

View File

@ -8,6 +8,10 @@ template "#{node.cobbler.preseed_dir}/centos-6.2-x86_64.ks" do
owner "root"
group "root"
mode "0644"
variables(
:late_authorized_keys => LateFile.new("/root/.ssh/id_rsa.pub"),
:late_deploy => LateFile.new("/opt/nailgun/bin/deploy")
)
end
directory "#{node["cobbler"]["centos-6.2-x86_64_mnt"]}" do

View File

@ -68,6 +68,11 @@ template "/etc/cobbler/pxe/pxedefault.template" do
notifies :run, "execute[cobbler_sync]"
end
template "/etc/cobbler/power/power_ssh.template" do
source "power_ssh.template"
mode 0644
end
directory node["cobbler"]["ks_mirror_dir"] do
owner "root"
group "root"
@ -80,3 +85,10 @@ include_recipe "cobbler::bootstrap"
include_recipe "cobbler::precise-x86_64"
include_recipe "cobbler::centos-6.2-x86_64"
# FIXME
# TO WORK CORRECTLY COBBLER NEEDED TO BE RESTRTED AND RESYNCED
# ruby_block "notify cobbler sync" do
# block {}
# notifies :run, "execute[cobbler_sync]"
# end

View File

@ -36,3 +36,25 @@ make
curl
dmidecode
rubygems
openssh-server
%post
# configure yum
rm /etc/yum.repos.d/*
cat > /etc/yum.repos.d/nailgun.repo <<EOF
[nailgun]
name=Nailgun Repository
baseurl=http://<%= node.cobbler.repoaddr %>/centos/6.2
enabled=1
gpgcheck=0
EOF
# configure ssh key
mkdir -p /root/.ssh
chown -R root:root /root/.ssh
chmod 700 /root/.ssh
<%= @late_authorized_keys.init.late_file("/root/.ssh/authorized_keys", "644") %>
# deploy script
mkdir -p /opt/nailgun/bin
<%= @late_deploy.init.late_file("/opt/nailgun/bin/deploy", "755") %>

View File

@ -0,0 +1,26 @@
## Set proper virsh operation
#if $power_mode == "reboot"
#set operation = "reboot"
#else if $power_mode == "off"
#set operation = "shutdown -h now"
#else
#set operation = "unknown"
#end if
#if $power_pass and $power_pass.count(':') > 0
#set (passtype, pass) = $power_pass.split(':', 1)
#else
#set (passtype, pass) = ("plain", $power_pass)
#end if
#if $power_user
#set username = "%s@" % $power_user
#else
#set username = "unknown"
#end if
if [ X$passtype = Xrsa -o X$passtype = Xdsa ]; then
if [ X$passtype = "" X$operation != Xunknown -a X$username != Xunknown ]; then
/usr/bin/ssh -i $pass $username$power_address $operation
fi
fi