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
bcea9977
Unverified
Commit
bcea9977
authored
Jun 17, 2016
by
arbabnazar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use YAML dictionaries for ansible tasks
parent
0a993c8d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
50 deletions
+60
-50
playbooks/roles/splunkforwarder/handlers/main.yml
+3
-1
playbooks/roles/splunkforwarder/tasks/main.yml
+57
-49
No files found.
playbooks/roles/splunkforwarder/handlers/main.yml
View file @
bcea9977
...
@@ -17,4 +17,6 @@
...
@@ -17,4 +17,6 @@
# Restart Splunk
# Restart Splunk
-
name
:
restart splunkforwarder
-
name
:
restart splunkforwarder
service
:
name=splunk state=restarted
service
:
name
:
splunk
state
:
restarted
playbooks/roles/splunkforwarder/tasks/main.yml
View file @
bcea9977
...
@@ -22,83 +22,90 @@
...
@@ -22,83 +22,90 @@
#
#
# Install Splunk Forwarder
# Install Splunk Forwarder
-
name
:
install splunkforwarder specific system packages
-
name
:
Install splunkforwarder specific system packages
apt
:
pkg={{','.join(splunk_debian_pkgs)}} state=present
apt
:
name
:
"
{{
item
}}"
state
:
present
with_items
:
"
{{
splunk_debian_pkgs
}}"
tags
:
tags
:
-
splunk
-
splunk
-
install
-
install
-
update
-
update
-
name
:
d
ownload the splunk deb
-
name
:
D
ownload the splunk deb
get_url
:
>
get_url
:
dest
=
"/tmp/{{ SPLUNKFORWARDER_DEB }}"
dest
:
"
/tmp/{{
SPLUNKFORWARDER_DEB
}}"
url
=
"{{ SPLUNKFORWARDER_PACKAGE_URL }}"
url
:
"
{{
SPLUNKFORWARDER_PACKAGE_URL
}}"
register
:
download_deb
register
:
download_deb
-
name
:
i
nstall splunk forwarder
-
name
:
I
nstall splunk forwarder
shell
:
gdebi -nq /tmp/{{ SPLUNKFORWARDER_DEB }}
shell
:
"
gdebi
-nq
/tmp/{{
SPLUNKFORWARDER_DEB
}}"
when
:
download_deb.changed
when
:
download_deb.changed
# Create splunk user
-
name
:
Create splunk user
-
name
:
create splunk user
user
:
user
:
name=splunk createhome=no state=present append=yes groups=syslog,adm
name
:
splunk
createhome
:
no
state
:
present
append
:
yes
groups
:
syslog,adm
when
:
download_deb.changed
when
:
download_deb.changed
# Need to start splunk manually so that it can create various files
# Need to start splunk manually so that it can create various files
# and directories that aren't created till the first run and are needed
# and directories that aren't created till the first run and are needed
# to run some of the below commands.
# to run some of the below commands.
-
name
:
s
tart splunk manually
-
name
:
S
tart splunk manually
shell
:
>
shell
:
"
{{
splunkforwarder_output_dir
}}/bin/splunk
start
--accept-license
--answer-yes
--no-prompt"
{{ splunkforwarder_output_dir }}/bin/splunk start --accept-license --answer-yes --no-prompt
args
:
creates
={{ splunkforwarder_output_dir }}/var/lib/splunk
creates
:
"
{{
splunkforwarder_output_dir
}}/var/lib/splunk"
when
:
download_deb.changed
when
:
download_deb.changed
register
:
started_manually
register
:
started_manually
-
name
:
stop splunk manually
-
name
:
Stop splunk manually
shell
:
>
shell
:
"
{{
splunkforwarder_output_dir
}}/bin/splunk
stop
--accept-license
--answer-yes
--no-prompt"
{{ splunkforwarder_output_dir }}/bin/splunk stop --accept-license --answer-yes --no-prompt
when
:
download_deb.changed and started_manually.changed
when
:
download_deb.changed and started_manually.changed
-
name
:
c
reate boot script
-
name
:
C
reate boot script
shell
:
>
shell
:
"
{{
splunkforwarder_output_dir
}}/bin/splunk
enable
boot-start
-user
splunk
--accept-license
--answer-yes
--no-prompt"
{{ splunkforwarder_output_dir }}/bin/splunk enable boot-start -user splunk --accept-license --answer-yes --no-prompt
args
:
creates
=
/etc/init.d/splunk
creates
:
/etc/init.d/splunk
register
:
create_boot_script
register
:
create_boot_script
when
:
download_deb.changed
when
:
download_deb.changed
notify
:
restart splunkforwarder
notify
:
restart splunkforwarder
# Ensure permissions on splunk content
-
name
:
Ensure splunk forder permissions
-
name
:
ensure splunk forder permissions
file
:
file
:
path={{ splunkforwarder_output_dir }} state=directory recurse=yes owner=splunk group=splunk
path
:
"
{{
splunkforwarder_output_dir
}}"
state
:
directory
recurse
:
yes
owner
:
splunk
group
:
splunk
when
:
download_deb.changed
when
:
download_deb.changed
notify
:
restart splunkforwarder
notify
:
restart splunkforwarder
# Update credentials
-
name
:
Update admin pasword
-
name
:
update admin pasword
shell
:
"
{{
splunkforwarder_output_dir
}}/bin/splunk
edit
user
admin
-password
{{
SPLUNKFORWARDER_PASSWORD
}}
-auth
admin:changeme
--accept-license
--answer-yes
--no-prompt"
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
when
:
download_deb.changed
notify
:
restart splunkforwarder
notify
:
restart splunkforwarder
-
name
:
add chkconfig to init script
-
name
:
Add chkconfig to init script
shell
:
'
sed
-i
-e
"s/\/bin\/sh/\/bin\/sh\n#
chkconfig:
235
98
55/"
/etc/init.d/splunk'
lineinfile
:
dest
:
/etc/init.d/splunk
regexp
:
"
^#
chkconfig:
235
98
55"
line
:
"
#
chkconfig:
235
98
55"
insertafter
:
"
#!/bin/sh"
state
:
present
when
:
download_deb.changed and create_boot_script.changed
when
:
download_deb.changed and create_boot_script.changed
notify
:
restart splunkforwarder
notify
:
restart splunkforwarder
# Drop template files.
-
name
:
Create inputs and outputs configuration
-
name
:
drop input configuration
template
:
template
:
src=opt/splunkforwarder/etc/system/local/inputs.conf.j2
src
:
"
opt/splunkforwarder/etc/system/local/{{
item
}}.conf.j2"
dest=/opt/splunkforwarder/etc/system/local/inputs.conf
dest
:
"
/opt/splunkforwarder/etc/system/local/{{
item
}}.conf"
owner=splunk
owner
:
splunk
group=splunk
group
:
splunk
mode=644
mode
:
644
notify
:
restart splunkforwarder
with_items
:
-
inputs
-
name
:
create outputs config file
-
outputs
template
:
notify
:
restart splunkforwarder
src=opt/splunkforwarder/etc/system/local/outputs.conf.j2
\ No newline at end of file
dest=/opt/splunkforwarder/etc/system/local/outputs.conf
owner=splunk
group=splunk
mode=644
notify
:
restart splunkforwarder
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