Commit a5912c02eb57a0ed9415b98dcc82fa3cee4a994a

Authored by Jacob Vosmaer
1 parent ebdaf3c1

Import recipes/default.rb from omnibus-chef-server

Repo
https://github.com/opscode/omnibus-chef-server.git
Path
files/chef-server-cookbooks/chef-server/recipes/default.rb
Revision
6a11fd840045a7ae7961e5a37439371b7407f3e9
files/gitlab-cookbooks/gitlab/recipes/default.rb
  1 +#
  2 +# Copyright:: Copyright (c) 2012 Opscode, Inc.
  3 +# License:: Apache License, Version 2.0
  4 +#
  5 +# Licensed under the Apache License, Version 2.0 (the "License");
  6 +# you may not use this file except in compliance with the License.
  7 +# You may obtain a copy of the License at
  8 +#
  9 +# http://www.apache.org/licenses/LICENSE-2.0
  10 +#
  11 +# Unless required by applicable law or agreed to in writing, software
  12 +# distributed under the License is distributed on an "AS IS" BASIS,
  13 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14 +# See the License for the specific language governing permissions and
  15 +# limitations under the License.
  16 +#
  17 +
  18 +require 'openssl'
  19 +
  20 +ENV['PATH'] = "/opt/chef-server/bin:/opt/chef-server/embedded/bin:#{ENV['PATH']}"
  21 +
  22 +directory "/etc/chef-server" do
  23 + owner "root"
  24 + group "root"
  25 + mode "0775"
  26 + action :nothing
  27 +end.run_action(:create)
  28 +
  29 +if File.exists?("/etc/chef-server/chef-server.json")
  30 + Chef::Log.warn("Please move to /etc/chef-server/chef-server.rb for configuration - /etc/chef-server/chef-server.json is deprecated.")
  31 +else
  32 + ChefServer[:node] = node
  33 + if File.exists?("/etc/chef-server/chef-server.rb")
  34 + ChefServer.from_file("/etc/chef-server/chef-server.rb")
  35 + end
  36 + node.consume_attributes(ChefServer.generate_config(node['fqdn']))
  37 +end
  38 +
  39 +if File.exists?("/var/opt/chef-server/bootstrapped")
  40 + node.set['chef_server']['bootstrap']['enable'] = false
  41 +end
  42 +
  43 +# Create the Chef User
  44 +include_recipe "chef-server::users"
  45 +
  46 +directory "/etc/chef" do
  47 + owner "root"
  48 + group node['chef_server']['user']['username']
  49 + mode "0775"
  50 + action :create
  51 +end
  52 +
  53 +directory "/var/opt/chef-server" do
  54 + owner "root"
  55 + group "root"
  56 + mode "0755"
  57 + recursive true
  58 + action :create
  59 +end
  60 +
  61 +# Install our runit instance
1 62 include_recipe "runit"
  63 +
  64 +# Configure Services
  65 +[
  66 + "rabbitmq",
  67 + "postgresql",
  68 + "chef-solr",
  69 + "chef-expander",
  70 + "bookshelf",
  71 + "erchef",
  72 + "bootstrap",
  73 + "chef-server-webui",
  74 + "nginx"
  75 +].each do |service|
  76 + if node["chef_server"][service]["enable"]
  77 + include_recipe "chef-server::#{service}"
  78 + else
  79 + include_recipe "chef-server::#{service}_disable"
  80 + end
  81 +end
  82 +
  83 +include_recipe "chef-server::chef-pedant"
  84 +
  85 +file "/etc/chef-server/chef-server-running.json" do
  86 + owner node['chef_server']['user']['username']
  87 + group "root"
  88 + mode "0600"
  89 + content Chef::JSONCompat.to_json_pretty({ "chef_server" => node['chef_server'].to_hash, "run_list" => node.run_list })
  90 +end
... ...