cookbook-monasca-schema/recipes/vertica.rb
Tim Kuhlman 51fd328fef Added files to get build to work
Try and create Berksfile that will work with berkshelf 2 or 3

Fixed style issues

Also, added .gitreview file

Change-Id: I47caf4930ac18bcfc62737e851fff1fe15dd9c9f
2014-08-15 10:12:23 -06:00

43 lines
1.2 KiB
Ruby

# encoding: UTF-8#
#
# Lays down a db creation script and default schema
# There is a bug where $HOME is not set currectly for exec, I use sudo to
# avoid this https://tickets.opscode.com/browse/CHEF-2288
bash 'create_mon_db' do
action :nothing
user 'root'
code <<-EOH
ulimit -n 65536 # Max files open limit must be set for db creation to work.
sudo -Hu dbadmin /var/vertica/create_mon_db.sh
EOH
end
# Note: As projections based on k-safety are added this file list will need
# modification based on a clustered or not setup
%w[ mon_grants.sql mon_schema.sql mon_metrics_schema.sql
mon_alarms_schema.sql mon_users.sql ].each do |filename|
cookbook_file "/var/vertica/#{filename}" do
action :create
source "vertica/#{filename}"
owner node[:vertica][:dbadmin_user]
group node[:vertica][:dbadmin_group]
mode '644'
end
end
if node.default[:vertica][:cluster]
setup_script = 'create_mon_db_cluster.sh'
else
setup_script = 'create_mon_db.sh'
end
cookbook_file '/var/vertica/create_mon_db.sh' do
action :create
source "vertica/#{setup_script}"
owner node[:vertica][:dbadmin_user]
group node[:vertica][:dbadmin_group]
mode '755'
notifies :run, 'bash[create_mon_db]'
end