From 99f145ba2d1607ee5ef3ee813c8b557ca0a2ff1f Mon Sep 17 00:00:00 2001 From: xiaodongwang <xiaodongwang@huawei.com> Date: Wed, 4 Jun 2014 14:19:21 -0700 Subject: [PATCH] update chef and cobbler config to make ubuntu 12.04 work Change-Id: I9d96382eae67421b33c33c64f0af17e14fe8acd2 --- chef/cookbooks/haproxy/recipes/tcp_lb.rb | 11 ++++++++++ chef/cookbooks/keepalived/recipes/default.rb | 15 ++++++++++++++ .../openstack-common/recipes/default.rb | 20 +++++++++++++++---- .../rsyslog/templates/default/cinder.conf.erb | 12 +++++++++++ .../rsyslog/templates/default/glance.conf.erb | 12 +++++++++++ .../templates/default/keystone.conf.erb | 12 +++++++++++ .../rsyslog/templates/default/nova.conf.erb | 12 +++++++++++ .../templates/default/quantum.conf.erb | 12 +++++++++++ cobbler/kickstarts/default.seed | 4 ++++ .../preseed_post_install_network_config | 1 + 10 files changed, 107 insertions(+), 4 deletions(-) create mode 100644 chef/cookbooks/rsyslog/templates/default/cinder.conf.erb create mode 100644 chef/cookbooks/rsyslog/templates/default/glance.conf.erb create mode 100644 chef/cookbooks/rsyslog/templates/default/keystone.conf.erb create mode 100644 chef/cookbooks/rsyslog/templates/default/nova.conf.erb create mode 100644 chef/cookbooks/rsyslog/templates/default/quantum.conf.erb diff --git a/chef/cookbooks/haproxy/recipes/tcp_lb.rb b/chef/cookbooks/haproxy/recipes/tcp_lb.rb index 9a0929b..63929cf 100644 --- a/chef/cookbooks/haproxy/recipes/tcp_lb.rb +++ b/chef/cookbooks/haproxy/recipes/tcp_lb.rb @@ -120,6 +120,17 @@ template "#{node['haproxy']['conf_dir']}/haproxy.cfg" do ) end +case node["platform_family"] +when "debian" + cookbook_file "/etc/default/haproxy" do + source "haproxy-default" + owner "root" + group "root" + mode 00644 + notifies :restart, "service[haproxy]" + end +end + service "haproxy" do supports :restart => true, :status => true, :reload => true action [:enable, :start] diff --git a/chef/cookbooks/keepalived/recipes/default.rb b/chef/cookbooks/keepalived/recipes/default.rb index 0b4ef47..48875e5 100644 --- a/chef/cookbooks/keepalived/recipes/default.rb +++ b/chef/cookbooks/keepalived/recipes/default.rb @@ -52,6 +52,21 @@ if mydata['ha']['status'].eql?('enable') "#{mydata['ha']['keepalived']['instance_name']['vip']} dev #{interface}" ] end +case node["platform_family"] +when "debian" + execute "apt-update" do + user "root" + command "apt-get -y update" + action :run + end + + execute "apt-upgrade" do + user "root" + command "apt-get -y upgrade" + action :run + end +end + package "keepalived" if node['keepalived']['shared_address'] diff --git a/chef/cookbooks/openstack-common/recipes/default.rb b/chef/cookbooks/openstack-common/recipes/default.rb index dc018cd..acadc76 100644 --- a/chef/cookbooks/openstack-common/recipes/default.rb +++ b/chef/cookbooks/openstack-common/recipes/default.rb @@ -21,10 +21,6 @@ include_recipe "openstack-common::databag" case node["platform_family"] when "debian" - package "ubuntu-cloud-keyring" do - action :install - end - apt_uri = node["openstack"]["apt"]["uri"] apt_components = node["openstack"]["apt"]["components"] @@ -39,6 +35,22 @@ when "debian" components apt_components end + execute "apt-update" do + user "root" + command "apt-get -y update" + action :run + end + + execute "apt-upgrade" do + user "root" + command "apt-get -y upgrade" + action :run + end + + package "ubuntu-cloud-keyring" do + action :install + end + when "suse" if node["lsb"]["description"].nil? # Workaround for SLE11 diff --git a/chef/cookbooks/rsyslog/templates/default/cinder.conf.erb b/chef/cookbooks/rsyslog/templates/default/cinder.conf.erb new file mode 100644 index 0000000..83976f4 --- /dev/null +++ b/chef/cookbooks/rsyslog/templates/default/cinder.conf.erb @@ -0,0 +1,12 @@ +$Modload imfile +<% @loglist.each do |service, path| -%> + # <%= service %> + $InputFileName <%= path %> + $InputFileReadMode 0 + $InputFileTag <%= service %> + $InputFileSeverity notice + $InputFileFacility local4 + $InputFileStateFile <%= service %> + $InputRunFileMonitor + $InputFilePollInterval 2 +<% end -%> diff --git a/chef/cookbooks/rsyslog/templates/default/glance.conf.erb b/chef/cookbooks/rsyslog/templates/default/glance.conf.erb new file mode 100644 index 0000000..83976f4 --- /dev/null +++ b/chef/cookbooks/rsyslog/templates/default/glance.conf.erb @@ -0,0 +1,12 @@ +$Modload imfile +<% @loglist.each do |service, path| -%> + # <%= service %> + $InputFileName <%= path %> + $InputFileReadMode 0 + $InputFileTag <%= service %> + $InputFileSeverity notice + $InputFileFacility local4 + $InputFileStateFile <%= service %> + $InputRunFileMonitor + $InputFilePollInterval 2 +<% end -%> diff --git a/chef/cookbooks/rsyslog/templates/default/keystone.conf.erb b/chef/cookbooks/rsyslog/templates/default/keystone.conf.erb new file mode 100644 index 0000000..83976f4 --- /dev/null +++ b/chef/cookbooks/rsyslog/templates/default/keystone.conf.erb @@ -0,0 +1,12 @@ +$Modload imfile +<% @loglist.each do |service, path| -%> + # <%= service %> + $InputFileName <%= path %> + $InputFileReadMode 0 + $InputFileTag <%= service %> + $InputFileSeverity notice + $InputFileFacility local4 + $InputFileStateFile <%= service %> + $InputRunFileMonitor + $InputFilePollInterval 2 +<% end -%> diff --git a/chef/cookbooks/rsyslog/templates/default/nova.conf.erb b/chef/cookbooks/rsyslog/templates/default/nova.conf.erb new file mode 100644 index 0000000..83976f4 --- /dev/null +++ b/chef/cookbooks/rsyslog/templates/default/nova.conf.erb @@ -0,0 +1,12 @@ +$Modload imfile +<% @loglist.each do |service, path| -%> + # <%= service %> + $InputFileName <%= path %> + $InputFileReadMode 0 + $InputFileTag <%= service %> + $InputFileSeverity notice + $InputFileFacility local4 + $InputFileStateFile <%= service %> + $InputRunFileMonitor + $InputFilePollInterval 2 +<% end -%> diff --git a/chef/cookbooks/rsyslog/templates/default/quantum.conf.erb b/chef/cookbooks/rsyslog/templates/default/quantum.conf.erb new file mode 100644 index 0000000..83976f4 --- /dev/null +++ b/chef/cookbooks/rsyslog/templates/default/quantum.conf.erb @@ -0,0 +1,12 @@ +$Modload imfile +<% @loglist.each do |service, path| -%> + # <%= service %> + $InputFileName <%= path %> + $InputFileReadMode 0 + $InputFileTag <%= service %> + $InputFileSeverity notice + $InputFileFacility local4 + $InputFileStateFile <%= service %> + $InputRunFileMonitor + $InputFilePollInterval 2 +<% end -%> diff --git a/cobbler/kickstarts/default.seed b/cobbler/kickstarts/default.seed index 0ef43b8..583d5b0 100644 --- a/cobbler/kickstarts/default.seed +++ b/cobbler/kickstarts/default.seed @@ -92,6 +92,10 @@ d-i debian-installer/allow_unauthenticated string true # Avoid that last message about the install being complete. d-i finish-install/reboot_in_progress note +# This will prevent the installer from ejecting the CD during the reboot, +# which is useful in some situations. +d-i cdrom-detect/eject boolean false + # This command is run just before the install finishes, but when there is # still a usable /target directory. You can chroot to /target and use it # directly, or use the apt-install and in-target commands to easily install diff --git a/cobbler/snippets/preseed_post_install_network_config b/cobbler/snippets/preseed_post_install_network_config index 7552798..90a54d6 100644 --- a/cobbler/snippets/preseed_post_install_network_config +++ b/cobbler/snippets/preseed_post_install_network_config @@ -104,6 +104,7 @@ echo "iface $iname inet static" >> /target/etc/network/interfaces; \ echo " hwaddress $mac" >> /target/etc/network/interfaces; \ #end if #if $iname in $promisc_interfaces +echo " address 0.0.0.0" >> /target/etc/network/interfaces; \ echo " up ifconfig $iname promisc up" >> /target/etc/network/interfaces; \ echo " down ifconfig $iname promisc down" >> /target/etc/network/interfaces; \ #else