Skip to content

Instantly share code, notes, and snippets.

@jjasghar
Created December 14, 2016 18:34
Show Gist options
  • Save jjasghar/6d0794e6269ae0acab74a0f8eb649540 to your computer and use it in GitHub Desktop.
Save jjasghar/6d0794e6269ae0acab74a0f8eb649540 to your computer and use it in GitHub Desktop.
#
# Cookbook Name:: sensu_client
# Recipe:: windows
#
# Copyright (c) 2016 The Authors, All Rights Reserved.
directory "C:\\tmp" do
rights :full_control, 'tirefi\\administrator'
action :create
end
remote_file "C:\\tmp\\sensu.msi" do
source "https://sensu.global.ssl.fastly.net/msi/sensu-0.26.5-1.msi"
action :create
end
windows_package 'sensu' do
source "C:\\tmp\\sensu.msi"
action :install
end
directory "C:\\opt\\sensu\\conf.d" do
action :create
end
template "C:\\opt\\sensu\\config.json" do
source "config.json.erb"
end
template "C:\\opt\\sensu\\conf.d\\client.json" do
source "client_windows.json.erb"
end
template "C:\\opt\\sensu\\bin\\sensu-client.xml" do
source "sensu-client.xml.erb"
end
batch 'install sensu service' do
code <<-EOH
sc create sensu-client start= delayed-auto binPath= c:\\opt\\sensu\\bin\\sensu-client.exe DisplayName= "Sensu Client"
EOH
end
service "sensu-client" do
supports :status => true, :restart => true, :truereload => true
action [ :enable, :start ]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment