Skip to content

Instantly share code, notes, and snippets.

@kzk
Created December 19, 2011 07:13
Show Gist options
  • Save kzk/1495834 to your computer and use it in GitHub Desktop.
Save kzk/1495834 to your computer and use it in GitHub Desktop.
default.rb
#
# Cookbook Name:: td-agent
# Recipe:: default
#
# Copyright 2011, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
group 'td-agent' do
group_name 'td-agent'
gid 403
action [:create]
end
user 'td-agent' do
comment 'td-agent'
uid 403
group 'td-agent'
home '/var/run/td-agent'
shell '/bin/false'
password nil
supports :manage_home => true
action [:create, :manage]
end
directory '/etc/td-agent/' do
owner 'td-agent'
group 'td-agent'
mode '0755'
action :create
end
case node['platform']
when "ubuntu"
apt_repository "treasure-data" do
uri "http://packages.treasure-data.com/debian/"
distribution node['lsb']['codename']
components ["contrib"]
action :add
end
end
template "/etc/td-agent/td-agent.conf" do
mode "0644"
source "td-agent.conf.erb"
variables({
:node_name => node.name
})
end
package "td-agent" do
options "-f --force-yes"
action :upgrade
end
service "td-agent" do
action [ :enable, :start ]
subscribes :restart, resources(:template => "/etc/td-agent/td-agent.conf")
end
# Source descriptions
## built-in TCP input
<source>
type tcp
port 24224
</source>
## HTTP input
<source>
type http
port 8888
</source>
# Output descriptions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment