-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathplaybook.yml
104 lines (85 loc) · 3.21 KB
/
playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
---
- hosts: default
vars:
splunkver: 6.2.3-264376-linux-2.6-x86_64
installapps: False
# ssl_enabled
# auth_enabled
tasks:
- name: Ensure libselinux-python installed
yum: name=libselinux-python state=present
- name: Ensure aliases.sh present
copy: src=files/aliases.sh dest=/etc/profile.d/aliases.sh
owner=root group=root mode=0644
- name: Ensure EPEL repo is configured
shell: rpm -q epel-release || yum install -y http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
- name: Ensure hostname set
hostname: name={{ inventory_hostname }}
when: not inventory_hostname|match('(\d{1,3}\.){3}\d{1,3}')
- name: Ensure hostname is in /etc/hosts
lineinfile:
dest=/etc/hosts
regexp="^{{ ansible_default_ipv4.address }}.+$"
line="{{ ansible_default_ipv4.address }} {{ ansible_fqdn }} {{ ansible_hostname }}"
# pulls from EPEL
- name: Ensure nginx is installed
yum: name=nginx state=present
- name: Ensure nginx config in place
copy: dest=/etc/nginx/nginx.conf
src=files/nginx.conf
notify:
- restart nginx
- name: Ensure nginx proxies for local Splunk
template: src=templates/splunk.conf.j2 dest=/etc/nginx/conf.d/splunk.conf
owner=root group=root mode=0644
notify:
- restart nginx
- name: Ensure Splunk package installed
yum: name=/vagrant/sw/splunk-{{ splunkver }}.rpm state=present
# https://apps.splunk.com/app/466/
- name: Install Sideview Utils
unarchive: src=sw/sideview-utils-lgpl_135.tgz
dest=/opt/splunk/etc/apps
creates=/opt/splunk/etc/apps/sideview_utils
when: installapps
notify:
- restart splunk
# https://apps.splunk.com/app/748/
- name: Install SoS
unarchive: src=sw/sos-splunk-on-splunk_32.tgz
dest=/opt/splunk/etc/apps
creates=/opt/splunk/etc/apps/sos
when: installapps
notify:
- restart splunk
# https://apps.splunk.com/app/1603/
- name: Install Splunk-6 dashboard examples
unarchive: src=sw/splunk-6x-dashboard-examples_201.tgz
dest=/opt/splunk/etc/apps
creates=/opt/splunk/etc/apps/simple_xml_examples
when: installapps
notify:
- restart splunk
# https://apps.splunk.com/app/273/
- name: Install Splunk App for UNIX and Linux
unarchive: src=sw/splunk-app-for-unix-and-linux_501.tgz
dest=/opt/splunk/etc/apps
creates=/opt/splunk/etc/apps/splunk_app_for_nix
when: installapps
notify:
- restart splunk
- name: Ensure Splunk service is configured
copy: src=files/splunk.init dest=/etc/init.d/splunk
owner=root group=root mode=0755
notify:
- restart splunk
- name: Start Splunk service
service: name=splunk state=started enabled=yes
- name: Start nginx service
service: name=nginx state=started enabled=yes
handlers:
- name: restart splunk
service: name=splunk state=restarted
- name: restart nginx
service: name=nginx state=restarted
# vim: set ts=2 sw=2 et ft=ansible: