some fixes in cookbooks

This commit is contained in:
Vladimir Kozhukalov 2012-06-05 17:26:02 +04:00
parent 9155d67014
commit 6ea8cec81e
2 changed files with 25 additions and 17 deletions

View File

@ -21,7 +21,7 @@ end
template "/etc/cobbler/modules.conf" do template "/etc/cobbler/modules.conf" do
source "modules.conf.erb" source "modules.conf.erb"
mode 0644 mode 0644
notifies :restart, "service[cobbler]", :immediately notifies :restart, "service[cobbler]"
end end
template "/etc/cobbler/settings" do template "/etc/cobbler/settings" do
@ -31,7 +31,7 @@ template "/etc/cobbler/settings" do
:next_server => node["cobbler"]["next_server"], :next_server => node["cobbler"]["next_server"],
:cobbler_server => node["cobbler"]["cobbler_server"] :cobbler_server => node["cobbler"]["cobbler_server"]
) )
notifies :restart, "service[cobbler]", :immediately notifies :restart, "service[cobbler]"
end end
@ -48,7 +48,7 @@ template "/etc/cobbler/dnsmasq.template" do
:dhcp_range => node["cobbler"]["dhcp_range"], :dhcp_range => node["cobbler"]["dhcp_range"],
:gateway => node["cobbler"]["gateway"] :gateway => node["cobbler"]["gateway"]
) )
notifies :run, "execute[cobbler_sync]", :immediately notifies :run, "execute[cobbler_sync]"
end end
template "/etc/cobbler/pxe/pxedefault.template" do template "/etc/cobbler/pxe/pxedefault.template" do
@ -57,7 +57,7 @@ template "/etc/cobbler/pxe/pxedefault.template" do
variables( variables(
:pxetimeout => node["cobbler"]["pxetimeout"] :pxetimeout => node["cobbler"]["pxetimeout"]
) )
notifies :run, "execute[cobbler_sync]", :immediately notifies :run, "execute[cobbler_sync]"
end end
@ -95,7 +95,7 @@ file "/etc/dnsmasq.d/mirantis.net.conf" do
action :create action :create
content "server=/mirantis.net/#{node["cobbler"]["updns"]}" content "server=/mirantis.net/#{node["cobbler"]["updns"]}"
mode 0644 mode 0644
notifies :restart, "service[dnsmasq]", :immediately notifies :restart, "service[dnsmasq]"
end end
link "#{node["cobbler"]["bootstrap_ks_mirror_dir"]}/linux" do link "#{node["cobbler"]["bootstrap_ks_mirror_dir"]}/linux" do

View File

@ -18,43 +18,51 @@ user node.nailgun.user do
end end
file "#{node[:nailgun][:root]}/nailgun/venv.py" do file "#{node[:nailgun][:root]}/nailgun/venv.py" do
content "VENV = #{node.nailgun.venv}/local/lib/python2.7/site-packages" content "VENV = '#{node[:nailgun][:venv]}/local/lib/python2.7/site-packages'
"
owner node.nailgun.user owner node.nailgun.user
group node.nailgun.group group node.nailgun.group
mode 644 mode 644
end end
# it is assumed that nailgun files already installed into nailgun.root # it is assumed that nailgun files already installed into nailgun.root
execute 'chown #{node[:nailgun][:root]}' do execute 'chown nailgun root' do
command "chown -R #{node.nailgun.user}:#{node.nailgun.group} #{node.nailgun.root}" command "chown -R #{node[:nailgun][:user]}:#{node[:nailgun][:group]} #{node[:nailgun][:root]}"
end end
execute 'chmod #{node[:nailgun][:root]}' do execute 'chmod nailgun root' do
command "chmod -R u+w #{node.nailgun.root}" command "chmod -R u+w #{node[:nailgun][:root]}"
end end
execute 'Preseed Nailgun database' do execute 'Preseed Nailgun database' do
command '#{node.nailgun.python} manage.py loaddata nailgun/fixtures/default_env.json' command "#{node[:nailgun][:python]} manage.py loaddata nailgun/fixtures/default_env.json"
cwd node.nailgun.root cwd node.nailgun.root
user node.nailgun.user user node.nailgun.user
action :nothing action :nothing
end end
execute 'Sync Nailgun database' do execute 'Sync Nailgun database' do
command '#{node.nailgun.python} manage.py syncdb --noinput' command "#{node[:nailgun][:python]} manage.py syncdb --noinput"
cwd node.nailgun.root cwd node.nailgun.root
user node.nailgun.user user node.nailgun.user
notifies :run, resources('execute[Preseed Nailgun database]') notifies :run, resources('execute[Preseed Nailgun database]')
not_if "test -e #{node.nailgun.root}/nailgun.sqlite" not_if "test -e #{node[:nailgun][:root]}/nailgun.sqlite"
end end
execute 'Sync Nailgun database2' do
command "echo #{node[:nailgun][:python]} manage.py syncdb --noinput > /root/2"
not_if "test -e #{node[:nailgun][:root]}/nailgun.sqlite"
end
execute 'Sync Nailgun database3' do
command "echo #{node[:nailgun][:python]} manage.py syncdb --noinput > /root/3"
end
redis_instance 'nailgun' redis_instance 'nailgun'
celery_instance 'nailgun-jobserver' do celery_instance 'nailgun-jobserver' do
command '#{node.nailgun.python} manage.py celeryd_multi' command "#{node[:nailgun][:python]} manage.py celeryd_multi"
cwd node.nailgun.root cwd node.nailgun.root
events true events true
user node.nailgun.user user node.nailgun.user