Skip to content

Instantly share code, notes, and snippets.

@jjasghar jjasghar/windows.rb
Created Dec 14, 2016

Embed
What would you like to do?
#
# 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
You can’t perform that action at this time.