lib/dtk-node-agent/installer.rb in dtk-node-agent-0.6.7 vs lib/dtk-node-agent/installer.rb in dtk-node-agent-0.7.0
- old
+ new
@@ -34,12 +34,20 @@
shell "apt-get install -y #{package}"
end
shell "wget http://apt.puppetlabs.com/puppetlabs-release-#{@distcodename}.deb"
puts "Installing Puppet Labs repository..."
shell "dpkg -i puppetlabs-release-#{@distcodename}.deb"
+ puts "Installing Puppet Labs repository..."
+ shell "dpkg -i puppetlabs-release-#{@distcodename}.deb"
+ # install logstash forwarder
+ logstash_forwarder_url = CONFIG[:logstash_forwarder_deb64]
+ logstash_forwarder_package = logstash_forwarder_url.rpartition('/').last
+ shell "wget #{logstash_forwarder_url}"
+ puts "Installing logstash-forwarder"
+ shell "dpkg -i #{logstash_forwarder_package}"
shell "apt-get update"
- shell "rm puppetlabs-release-#{@distcodename}.deb"
+ shell "rm puppetlabs-release-#{@distcodename}.deb #{logstash_forwarder_package}"
# install mcollective
puts "Installing MCollective..."
shell "apt-get -y install mcollective"
# pin down the puppetlabs apt repo
FileUtils.cp("#{base_dir}/src/etc/apt/preferences.d/puppetlabs", "/etc/apt/preferences.d/puppetlabs")
@@ -72,9 +80,14 @@
# but only if the machine is running on AWS
if `curl -m 5 -sI http://169.254.169.254/latest/meta-data/`.include? '200 OK'
FileUtils.cp("#{base_dir}/src/etc/init.d/ec2-run-user-data", "/etc/init.d/ec2-run-user-data") unless File.exist?("/etc/init.d/ec2-run-user-data")
set_init("ec2-run-user-data")
end
+ # install logstash-forwarder
+ puts "Installing logstash-forwarder"
+ shell "rpm -ivh #{CONFIG[:logstash_forwarder_rpm64]}"
+ FileUtils.cp("#{base_dir}/src/etc/init.d/logstash-forwarder.rpm.init", "/etc/init.d/logstash-forwarder")
+ set_init("logstash-forwarder")
else
puts "Unsuported OS for automatic agent installation. Exiting now..."
exit(1)
end