cookbook-zabbix/recipes/proxy.rb

57 lines
1.5 KiB
Ruby
Raw Permalink Normal View History

2017-02-07 01:02:03 -05:00
#
# Cookbook Name:: zabbix
# Recipe:: proxy
#
# Copyright 2017, Linux-Help.org
# Authors:
# Eric Renfro <psi-jack@linux-help.org>
#
include_recipe 'chef-vault'
2017-02-07 01:02:03 -05:00
%w{zabbix-proxy-sqlite3 zabbix-get}.each do |pkg|
yum_package pkg do
version '3.0.5-1.el6'
allow_downgrade true
action :install
end
end
directory "/var/lib/zabbix" do
owner 'zabbix'
group 'zabbix'
mode '0750'
action :create
end
template "/etc/zabbix/zabbix_proxy.conf" do
credentials = chef_vault_item("secrets", "zabbix")
2017-02-07 01:02:03 -05:00
variables({
:DBUsername => credentials['username'],
:DBPassword => credentials['password'],
:DBDatabase => credentials['database']
2017-02-07 01:02:03 -05:00
})
source %W{
zabbix/#{node['zabbix']['version']}/#{node['platform']}-#{node['platform_version'].to_i}/zabbix_proxy.conf.erb
zabbix/#{node['zabbix']['version']}/#{node['platform']}/zabbix_proxy.conf.erb
zabbix/#{node['zabbix']['version']}/#{node['platform_family']}-#{node['platform_version'].to_i}/zabbix_proxy.conf.erb
zabbix/#{node['zabbix']['version']}/#{node['platform_family']}/zabbix_proxy.conf.erb
zabbix/#{node['zabbix']['version']}/zabbix_proxy.conf.erb
zabbix/zabbix_proxy.conf.erb
default/zabbix_proxy.conf.erb
zabbix_proxy.conf.erb
}
2017-02-07 01:02:03 -05:00
sensitive true
mode "0640"
owner "root"
group "root"
notifies :restart, "service[zabbix-proxy]", :immediately
end
service 'zabbix-proxy' do
supports :restart => true, :start => true
action :enable
end
include_recipe 'zabbix::agent'