From: Tom Hughes Date: Sun, 3 May 2015 15:13:03 +0000 (+0100) Subject: Update to chef server 12 X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/098634e073c80dfde4038715bc683985b18c5184 Update to chef server 12 --- diff --git a/cookbooks/chef/attributes/default.rb b/cookbooks/chef/attributes/default.rb index e572627f4..67bbc999f 100644 --- a/cookbooks/chef/attributes/default.rb +++ b/cookbooks/chef/attributes/default.rb @@ -2,7 +2,7 @@ default[:apt][:sources] = node[:apt][:sources] | ["opscode"] # Set the default server version -default[:chef][:server][:version] = "11.1.3-1" +default[:chef][:server][:version] = "12.0.8-1" # Set the default client version default[:chef][:client][:version] = "12.3.0-1" diff --git a/cookbooks/chef/files/default/knife.rb b/cookbooks/chef/files/default/knife.rb index c6b83f06a..d0da91066 100644 --- a/cookbooks/chef/files/default/knife.rb +++ b/cookbooks/chef/files/default/knife.rb @@ -1,4 +1,4 @@ -node_name "chef-git" +node_name "git" client_key "client.pem" validation_client_name "chef-validator" validation_key "/etc/chef/validation.pem" diff --git a/cookbooks/chef/recipes/repository.rb b/cookbooks/chef/recipes/repository.rb index 09713b4be..8c6bf236d 100644 --- a/cookbooks/chef/recipes/repository.rb +++ b/cookbooks/chef/recipes/repository.rb @@ -42,7 +42,7 @@ directory "/var/lib/chef/.chef" do end file "/var/lib/chef/.chef/client.pem" do - content keys["chef-git"].join("\n") + content keys["git"].join("\n") owner "chefrepo" group "chefrepo" mode 0660 diff --git a/cookbooks/chef/recipes/server.rb b/cookbooks/chef/recipes/server.rb index e76e074ea..54efa19e5 100644 --- a/cookbooks/chef/recipes/server.rb +++ b/cookbooks/chef/recipes/server.rb @@ -19,56 +19,38 @@ include_recipe "apache::ssl" -chef_platform = case node[:platform_version] - when "12.10" then "12.04" - when "14.04" then "12.04" - else node[:platform_version] - end - -chef_package = "chef-server_#{node[:chef][:server][:version]}_amd64.deb" - -directory "/var/cache/chef" do - owner "root" - group "root" - mode 0755 -end - -Dir.glob("/var/cache/chef/chef-server_*.deb").each do |deb| - next if deb == "/var/cache/chef/#{chef_package}" - - file deb do - action :delete - backup false - end -end - -remote_file "/var/cache/chef/#{chef_package}" do - source "https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/#{chef_platform}/x86_64/#{chef_package}" - owner "root" - group "root" - mode 0644 - backup false -end - -dpkg_package "chef-erver" do - source "/var/cache/chef/#{chef_package}" - version node[:chef][:server][:version] - notifies :run, "execute[chef-server-reconfigure]" -end - -ruby_block "/opt/chef-server/embedded/service/chef-server-webui/app/controllers/status_controller.rb" do - block do - rc = Chef::Util::FileEdit.new("/opt/chef-server/embedded/service/chef-server-webui/app/controllers/status_controller.rb") - rc.search_file_delete(/&rows=20/) - rc.write_file - - if rc.file_edited? - resources(:execute => "chef-server-reconfigure").run_action(:run) - end - end -end +# chef_package = "chef-server-core_#{node[:chef][:server][:version]}_amd64.deb" +# +# directory "/var/cache/chef" do +# owner "root" +# group "root" +# mode 0755 +# end +# +# Dir.glob("/var/cache/chef/chef-server-core_*.deb").each do |deb| +# next if deb == "/var/cache/chef/#{chef_package}" + +# file deb do +# action :delete +# backup false +# end +# end +# +# remote_file "/var/cache/chef/#{chef_package}" do +# source "https://web-dl.packagecloud.io/chef/stable/packages/ubuntu/#{node[:lsb][:codename]}/#{chef_package}" +# owner "root" +# group "root" +# mode 0644 +# backup false +# end +# +# dpkg_package "chef-server-core" do +# source "/var/cache/chef/#{chef_package}" +# version node[:chef][:server][:version] +# notifies :run, "execute[chef-server-reconfigure]" +# end -template "/etc/chef-server/chef-server.rb" do +template "/etc/opscode/chef-server.rb" do source "server.rb.erb" owner "root" group "root" @@ -83,7 +65,7 @@ execute "chef-server-reconfigure" do group "root" end -service "chef-server-runsvdir" do +service "private-chef-runsvdir" do provider Chef::Provider::Service::Upstart action [:enable, :start] supports :status => true, :restart => true, :reload => true diff --git a/cookbooks/chef/templates/default/server-backup.cron.erb b/cookbooks/chef/templates/default/server-backup.cron.erb index 3b7e953e7..c1e2100b3 100644 --- a/cookbooks/chef/templates/default/server-backup.cron.erb +++ b/cookbooks/chef/templates/default/server-backup.cron.erb @@ -7,8 +7,8 @@ B=chef-server-$D.tar.gz mkdir $T/chef-server-$D chgrp opscode-pgsql $T $T/chef-server-$D chmod g+rwx $T $T/chef-server-$D -sudo -u opscode-pgsql /opt/chef-server/embedded/bin/pg_dump --file=$T/chef-server-$D/chef.dmp --clean opscode_chef -ln -s /var/opt/chef-server/bookshelf/data $T/chef-server-$D/bookshelf +sudo -u opscode-pgsql /opt/opscode/embedded/bin/pg_dumpall --file=$T/chef-server-$D/chef.dmp --clean +ln -s /var/opt/opscode/bookshelf/data $T/chef-server-$D/bookshelf export GZIP="--rsyncable -9" diff --git a/cookbooks/chef/templates/default/server.rb.erb b/cookbooks/chef/templates/default/server.rb.erb index 5abb4ccd7..aa36dbd1b 100644 --- a/cookbooks/chef/templates/default/server.rb.erb +++ b/cookbooks/chef/templates/default/server.rb.erb @@ -1,14 +1,21 @@ # DO NOT EDIT - This file is being maintained by Chef -nginx['enable_non_ssl'] = true -nginx['non_ssl_port'] = 4000 +api_fqdn "chef.openstreetmap.org" +default_orgname "openstreetmap" + +addons['install'] = false + +bookshelf['url'] = "https://chef.openstreetmap.org:443" +bookshelf['vip'] = "chef.openstreetmap.org" + +lb['api_fqdn'] = "chef.openstreetmap.org" +lb['web_ui_fqdn'] = "chef.openstreetmap.org" + +nginx['non_ssl_port'] = false nginx['ssl_port'] = 4443 nginx['ssl_certificate'] = '/etc/ssl/certs/openstreetmap.pem' nginx['ssl_certificate_key'] = '/etc/ssl/private/openstreetmap.key' nginx['server_name'] = "chef.openstreetmap.org" nginx['url'] = "http://chef.openstreetmap.org:4000" -bookshelf['url'] = "https://chef.openstreetmap.org:443" -bookshelf['vip'] = "chef.openstreetmap.org" -lb['api_fqdn'] = "chef.openstreetmap.org" -lb['web_ui_fqdn'] = "chef.openstreetmap.org" -erchef['base_resource_url'] = "https://chef.openstreetmap.org" + +opscode_erchef['base_resource_url'] = "https://chef.openstreetmap.org"