5ce5e04f51
Add .gitreview, Gemfile, .rubocop.yml, Berksfile, Strainerfile Fixed style errors. Added empty unit test so chef-unit passes until we get real unit tests Change-Id: I75a9449a28cfc294eacbdc0003a8b7de2613290e
65 lines
1.3 KiB
Ruby
65 lines
1.3 KiB
Ruby
# encoding: UTF-8
|
|
#
|
|
include_recipe 'python'
|
|
|
|
# preferable for the OS to install this then to have pip compile
|
|
%w[ python-mysqldb libmysqlclient-dev ].each do |pkg_name|
|
|
package pkg_name do
|
|
action :install
|
|
end
|
|
end
|
|
|
|
python_pip 'mon-notification' do
|
|
action :install
|
|
end
|
|
|
|
group node[:mon_notification][:group] do
|
|
action :create
|
|
end
|
|
user node[:mon_notification][:user] do
|
|
action :create
|
|
system true
|
|
gid node[:mon_notification][:group]
|
|
end
|
|
|
|
template '/etc/init/mon-notification.conf' do
|
|
action :create
|
|
source 'mon-notification.conf.erb'
|
|
owner 'root'
|
|
group 'root'
|
|
mode 0644
|
|
end
|
|
|
|
service 'mon-notification' do
|
|
action :enable
|
|
provider Chef::Provider::Service::Upstart
|
|
end
|
|
|
|
directory node[:mon_notification][:conf_dir] do
|
|
action :create
|
|
owner 'root'
|
|
group 'root'
|
|
mode 0755
|
|
end
|
|
|
|
directory node[:mon_notification][:log_dir] do
|
|
action :create
|
|
owner node[:mon_notification][:user]
|
|
group node[:mon_notification][:group]
|
|
mode 0775
|
|
end
|
|
|
|
# TODO: setup an encrypted data bag for credentials
|
|
hosts = data_bag_item(node[:mon_notification][:data_bag], 'hosts')
|
|
template "#{node[:mon_notification][:conf_dir]}/notification.yaml" do
|
|
action :create
|
|
source 'notification.yaml.erb'
|
|
owner 'root'
|
|
group node[:mon_notification][:group]
|
|
mode 0640
|
|
variables(
|
|
hosts: hosts
|
|
)
|
|
notifies :restart, 'service[mon-notification]'
|
|
end
|