Skip to content

Commit

Permalink
rename cookbooks
Browse files Browse the repository at this point in the history
  • Loading branch information
gdbtek committed Dec 12, 2018
1 parent 79eb0c2 commit d0b36c7
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 73 deletions.
9 changes: 9 additions & 0 deletions cookbooks/splunk-forwarder/attributes/default.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash -e

export SPLUNK_FORWARDER_DOWNLOAD_URL='https://download.splunk.com/products/universalforwarder/releases/7.2.1/linux/splunkforwarder-7.2.1-be11b2c46e23-Linux-x86_64.tgz'
export SPLUNK_FORWARDER_INSTALL_FOLDER_PATH='/opt/splunkforwarder'

export SPLUNK_FORWARDER_USER_NAME='splunk'
export SPLUNK_FORWARDER_GROUP_NAME='splunk'

export SPLUNK_FORWARDER_SERVICE_NAME='splunk'
63 changes: 63 additions & 0 deletions cookbooks/splunk-forwarder/recipes/install.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash -e

function install()
{
umask '0022'

# Clean Up

initializeFolder "${SPLUNK_FORWARDER_INSTALL_FOLDER_PATH}"

# Install

unzipRemoteFile "${SPLUNK_FORWARDER_DOWNLOAD_URL}" "${SPLUNK_FORWARDER_INSTALL_FOLDER_PATH}"

# Config Init

if [[ "$(existCommand 'systemctl')" = 'true' ]]
then
local -r initConfigData=(
'__GROUP_NAME__' "${SPLUNK_FORWARDER_GROUP_NAME}"
'__INSTALL_FOLDER_PATH__' "${SPLUNK_FORWARDER_INSTALL_FOLDER_PATH}"
'__USER_NAME__' "${SPLUNK_FORWARDER_USER_NAME}"
)

createInitFileFromTemplate "${SPLUNK_FORWARDER_SERVICE_NAME}" "${APP_FOLDER_PATH}/../templates" "${initConfigData[@]}"
else
"${SPLUNK_FORWARDER_INSTALL_FOLDER_PATH}/bin/splunk" enable boot-start --accept-license --answer-yes --no-prompt
fi

# Config Profile

local -r profileConfigData=('__INSTALL_FOLDER_PATH__' "${SPLUNK_FORWARDER_INSTALL_FOLDER_PATH}")

createFileFromTemplate "${APP_FOLDER_PATH}/../templates/splunk.sh.profile" '/etc/profile.d/splunk.sh' "${profileConfigData[@]}"

# Enable (Not Start Yet)

addUser "${SPLUNK_FORWARDER_USER_NAME}" "${SPLUNK_FORWARDER_GROUP_NAME}" 'false' 'true' 'false'
chown -R "${SPLUNK_FORWARDER_USER_NAME}:${SPLUNK_FORWARDER_GROUP_NAME}" "${SPLUNK_FORWARDER_INSTALL_FOLDER_PATH}"
enableService "${SPLUNK_FORWARDER_SERVICE_NAME}"

umask '0077'
}

function main()
{
APP_FOLDER_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

source "${APP_FOLDER_PATH}/../../../libraries/util.bash"
source "${APP_FOLDER_PATH}/../attributes/default.bash"

checkRequireLinuxSystem
checkRequireRootUser

header 'INSTALLING SPLUNK-FORWARDER'

checkRequirePorts '8089'

install
installCleanUp
}

main "${@}"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Unit]
Description=SplunkForwarder Server
Description=Splunk-Forwarder Server
Wants=network.target syslog.service
After=network.target syslog.target

Expand Down
9 changes: 0 additions & 9 deletions cookbooks/splunkforwarder/attributes/default.bash

This file was deleted.

63 changes: 0 additions & 63 deletions cookbooks/splunkforwarder/recipes/install.bash

This file was deleted.

0 comments on commit d0b36c7

Please sign in to comment.