Sha256: fb3bc1f3b84acd0de4e489c491cd765f6b1063d4ad167553998988dc72d47645

Contents?: true

Size: 1.87 KB

Versions: 38

Compression:

Stored size: 1.87 KB

Contents

#
# Cookbook Name:: splunk
# Recipe:: server
#
# Author: Joshua Timberman <joshua@getchef.com>
# Copyright (c) 2014, Chef Software, Inc <legal@getchef.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
node.default['splunk']['is_server'] = true
include_recipe 'mu-splunk::user'
include_recipe 'mu-splunk::install_server'
include_recipe 'mu-splunk::service'
include_recipe 'mu-splunk::setup_auth'

# We can rely on loading the chef_vault_item here, as `setup_auth`
# above would have failed if there were another issue.
splunk_auth_info = chef_vault_item(node['splunk']['auth']['data_bag'], node['splunk']['auth']['data_bag_item'])['auth']

firewall_rule "HTTP ports for Splunk admin console" do
  port [80, 443]
end

execute 'enable-splunk-receiver-port' do
  command "\"#{splunk_cmd}\" enable listen #{node['splunk']['receiver_port']} -auth '#{splunk_auth_info}'"
  not_if do
    # TCPSocket will return a file descriptor if it can open the
    # connection, and raise Errno::ECONNREFUSED if it can't. We rescue
    # that exception and return false so not_if works proper-like.
    begin
      ::TCPSocket.new(node['ipaddress'], node['splunk']['receiver_port'])
    rescue Errno::ECONNREFUSED
      false
    end
  end
end
firewall_rule "Splunk receiver port(s)" do
  port [node['splunk']['receiver_port'].to_i, 8089]
end

if node['splunk']['ssl_options']['enable_ssl']
  include_recipe 'mu-splunk::setup_ssl'
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
cloud-mu-3.6.3 cookbooks/mu-splunk/recipes/server.rb
cloud-mu-3.5.1 cookbooks/mu-splunk/recipes/server.rb
cloud-mu-3.5.0 cookbooks/mu-splunk/recipes/server.rb
cloud-mu-3.4.0 cookbooks/mu-splunk/recipes/server.rb
cloud-mu-3.3.2 cookbooks/mu-splunk/recipes/server.rb
cloud-mu-3.3.1 cookbooks/mu-splunk/recipes/server.rb
cloud-mu-3.3.0 cookbooks/mu-splunk/recipes/server.rb
cloud-mu-3.2.0 cookbooks/mu-splunk/recipes/server.rb
cloud-mu-3.1.6 cookbooks/mu-splunk/recipes/server.rb
cloud-mu-3.1.5 cookbooks/mu-splunk/recipes/server.rb
cloud-mu-3.1.4 cookbooks/mu-splunk/recipes/server.rb
cloud-mu-3.1.3 cookbooks/mu-splunk/recipes/server.rb
cloud-mu-3.1.2 cookbooks/mu-splunk/recipes/server.rb
cloud-mu-3.1.2beta2 cookbooks/mu-splunk/recipes/server.rb
cloud-mu-3.1.1 cookbooks/mu-splunk/recipes/server.rb
cloud-mu-3.1.0 cookbooks/mu-splunk/recipes/server.rb
cloud-mu-3.0.2 cookbooks/mu-splunk/recipes/server.rb
cloud-mu-3.0.1 cookbooks/mu-splunk/recipes/server.rb
cloud-mu-3.0.0 cookbooks/mu-splunk/recipes/server.rb
cloud-mu-3.0.0beta cookbooks/mu-splunk/recipes/server.rb