Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
configuration
Commits
8e1b4e6b
Commit
8e1b4e6b
authored
Oct 02, 2013
by
Feanil Patel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the basic splunk role.
parent
3193d477
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
107 additions
and
39 deletions
+107
-39
playbooks/roles/splunk/tasks/main.yml
+0
-27
playbooks/roles/splunkforwarder/defaults/main.yml
+10
-7
playbooks/roles/splunkforwarder/handlers/main.yml
+0
-0
playbooks/roles/splunkforwarder/tasks/main.yml
+92
-0
playbooks/roles/splunkforwarder/templates/opt/splunkforwarder/etc/system/local/inputs.conf.j2
+3
-3
playbooks/roles/splunkforwarder/templates/opt/splunkforwarder/etc/system/local/outputs.conf.j2
+2
-2
No files found.
playbooks/roles/splunk/tasks/main.yml
deleted
100644 → 0
View file @
3193d477
---
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://github.com/edx/configuration/wiki
# code style: https://github.com/edx/configuration/wiki/Ansible-Coding-Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
#
#
# Tasks for role splunk
#
# Overview:
#
#
# Dependencies:
#
#
# Example play:
#
#
-
name
:
splunk | stub ansible task
debug
:
msg="This is a stub task created by the ansible-role role"
notify
:
splunk | notify me
\ No newline at end of file
playbooks/roles/splunk/defaults/main.yml
→
playbooks/roles/splunk
forwarder
/defaults/main.yml
View file @
8e1b4e6b
...
@@ -20,15 +20,18 @@ splunk_role_name: 'splunk'
...
@@ -20,15 +20,18 @@ splunk_role_name: 'splunk'
# OS packages
# OS packages
#
#
splunk_debian_pkgs
:
[]
splunk_debian_pkgs
:
-
gdebi
splunk_redhat_pkgs
:
[]
splunk_redhat_pkgs
:
[]
LOG_ITEMS
:
SPLUNKFORWARDER_
LOG_ITEMS
:
-
directory
:
'
/
var/
log'
-
directory
:
'
/
mnt/logs/lms/edx.
log'
recursive
:
true
index
:
'
feanilsandbox-lms'
SPLUNK_SERVER
:
'
localhost:9997'
SPLUNK
FORWARDER
_SERVER
:
'
localhost:9997'
log_items
:
$LOG_ITEMS
SPLUNKFORWARDER_PACKAGE_LOCATION
:
!!null
splunk_server
:
$SPLUNK_SERVER
SPLUNKFORWARDER_DEB
:
!!null
SPLUNKFORWARDER_PASSWORD
:
!!null
splunkforwarder_output_dir
:
'
/opt/splunkforwarder/'
playbooks/roles/splunk/handlers/main.yml
→
playbooks/roles/splunk
forwarder
/handlers/main.yml
View file @
8e1b4e6b
File moved
playbooks/roles/splunkforwarder/tasks/main.yml
0 → 100644
View file @
8e1b4e6b
---
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://github.com/edx/configuration/wiki
# code style: https://github.com/edx/configuration/wiki/Ansible-Coding-Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
#
#
# Tasks for role splunk
#
# Overview:
#
#
# Dependencies:
#
#
# Example play:
#
#
-
name
:
splunkforwarder | stub ansible task
debug
:
msg="This is a stub task created by the ansible-role role"
notify
:
splunk | notify me
# Install Splunk Forwarder
-
name
:
splunkforwarder| install splunkforwarder specific system packages
apt
:
pkg={{','.join(splunk_debian_pkgs)}} state=present
tags
:
-
splunk
-
install
-
update
-
name
:
splunkforwarder | download the splunk deb
shell
:
chdir="/tmp/"
executable="/bin/bash"
creates="/tmp/{{SPLUNKFORWARDER_DEB}}"
wget -q {{SPLUNKFORWARDER_PACKAGE_LOCATION}}{{SPLUNKFORWARDER_DEB}}
register
:
download_deb
-
name
:
splunkforwarder | install splunk forwarder
shell
:
gdebi -nq /tmp/{{SPLUNKFORWARDER_DEB}}
when
:
download_deb.changed
# Create splunk user
-
name
:
splunkforwarder | create splunk user
user
:
name=splunk group=splunk createhome=no state=present append=yes groups=syslog
when
:
download_deb.changed
-
name
:
splunkforwarder | create boot script
shell
:
creates=/etc/init.d/splunk {{splunkforwarder_output_dir}}/bin/splunk enable boot-start -user splunk --accept-license --answer-yes --no-prompt
register
:
create_boot_script
when
:
download_deb.changed
# Update credentials
-
name
:
splunkforwarder | update admin pasword
shell
:
"
{{splunkforwarder_output_dir}}/bin/splunk
edit
user
admin
-password
{{SPLUNKFORWARDER_PASSWORD}}
-auth
admin:changeme
--accept-license
--answer-yes
--no-prompt"
when
:
download_deb.changed
-
name
:
splunkforwarder | add chkconfig to init script
shell
:
'
sed
-i
-e
"s/\/bin\/sh/\/bin\/sh\n#
chkconfig:
235
98
55/"
/etc/init.d/splunk'
when
:
download_deb.changed and create_boot_script.changed
# Ensure permissions on splunk content
-
name
:
splunkforwarder | ensure splunk forder permissions
file
:
path={{splunkforwarder_output_dir}} state=directory recurse=yes owner=splunk group=splunk
when
:
download_deb.changed
# Drop template files.
-
name
:
splunkforwarder | drop input configuration
template
:
src=opt/splunkforwarder/etc/system/local/inputs.conf.j2
dest=/opt/splunkforwarder/etc/system/local/inputs.conf
owner=splunk
group=splunk
mode=644
-
name
:
splunkforwarder | create outputs config file
template
:
src=opt/splunkforwarder/etc/system/local/outputs.conf.j2
dest=/opt/splunkforwarder/etc/system/local/outputs.conf
owner=splunk
group=splunk
mode=644
# Restart Splunk
-
name
:
splunkforwarder | restart the splunk forwarder
service
:
name=splunk state=restarted
playbooks/roles/splunk
/templates/splunk.
inputs.conf.j2
→
playbooks/roles/splunk
forwarder/templates/opt/splunkforwarder/etc/system/local/
inputs.conf.j2
View file @
8e1b4e6b
[default]
[default]
host = {{ansible_hostname}}
host = {{ansible_hostname}}
{% for loggable in
log_items
%}
{% for loggable in
SPLUNKFORWARDER_LOG_ITEMS
%}
[monitor://{{loggable.directory}}]
[monitor://{{loggable.directory}}]
recursive = {{loggable.recursive|default(false)}}
recursive = {{loggable.recursive|default(false)}}
{% if loggable.sourcetype is defined %}
{% if loggable.sourcetype is defined %}
sourcetype =
loggable.sourcetype
sourcetype =
{{loggable.sourcetype}}
{% endif %}
{% endif %}
{% if loggable.index is defined %}
{% if loggable.index is defined %}
index =
loggable.index
index =
{{loggable.index}}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
playbooks/roles/splunk
/templates/splunk.
outputs.conf.j2
→
playbooks/roles/splunk
forwarder/templates/opt/splunkforwarder/etc/system/local/
outputs.conf.j2
View file @
8e1b4e6b
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
defaultGroup = default_output_server
defaultGroup = default_output_server
[tcpout:default_output_server]
[tcpout:default_output_server]
server = {{
splunk_server
}}
server = {{
SPLUNKFORWARDER_SERVER
}}
[tcpout-server://{{
splunk_server
}}]
[tcpout-server://{{
SPLUNKFORWARDER_SERVER
}}]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment