-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_playbook.yml
119 lines (99 loc) · 3.94 KB
/
example_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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
---
- hosts: indexers
gather_facts: no
become: yes
tasks:
- name: Checking if /home/splunk exist
file:
path: /home/splunk/
state: directory
owner: splunk
group: splunk
- name: Checking if .bashrc file exist
file:
path: /home/splunk/.bashrc
state: touch
owner: splunk
group: splunk
- name: Creating .bash_profile file in /opt/splunk
file:
path: /opt/splunk/.bash_profile
state: touch
owner: splunk
group: splunk
- name: Adding "source /opt/splunk/.bashrc" line to .bash_profile
lineinfile:
path: /opt/splunk/.bash_profile
state: present
line: source /home/splunk/.bashrc
- name: Now updating .bashrc file for AWS Indexers
blockinfile:
path: /home/splunk/.bashrc
marker_begin: "BEGIN CUSTOM BASHRC"
marker_end: "END CUSTOM BASHRC"
block: |
# DO NOT MODIFY ANYTHING BETWEEN THE ANSIBLE
# MANAGED BLOCK - IT WILL GET OVERWRITTEN
# WHEN UPDATES ARE PUSHED VIA ANSIBLE!
# stop here if this is not an interactive shell (e.g. ssh <hostname> ls)
[[ $- == *i* ]] || return
# Adds date/time to history command
export HISTTIMEFORMAT="%m/%d/%y %T "
################################
# Custom terminal prompt colors
################################
green=$(tput setaf 2);
cyan=$(tput setaf 6);
yellow=$(tput setaf 3);
white=$(tput setaf 7);
bold=$(tput bold);
reset=$(tput sgr0);
PS1="\[${bold}\]\n";
PS1+="\[${green}\]\u"; # Username
PS1+="\[${white}\] @ ";
PS1+="\[${cyan}\]\H"; # Hostname
PS1+="\[${white}\] in ";
PS1+="\[${yellow}\]\w "; # Working directory
PS1+="\n";
PS1+="\[${green}\](づ。◕‿‿◕。)づ\$ \[${reset}\]"; # `$` (and reset color)
export PS1;
#####################
# Custom CLI Aliases
#####################
alias splunk="/opt/splunk/bin/splunk"
alias ebrc="vim /home/splunk/.bashrc"
alias sbrc="source /home/splunk/.bashrc"
alias his="history"
alias c2sh="cd /home/splunk"
alias c2e="cd /opt/splunk/etc"
alias c2sl="cd /opt/splunk/etc/slave-apps"
alias c2s="cd /opt/splunk/etc/system/local"
alias scli="${BASH_ALIASES[splunk]}"
alias sssp="splunk show splunkd-port"
alias sssn="splunk show servername"
alias ssdh="splunk show default-hostname"
alias ssg="cat /opt/splunk/etc/instance.cfg"
alias lsg="ls -lah | grep -i"
alias e="exit"
echo -e "\e[38;5;198m";
echo ' __ __ _ __ ';
echo ' _________ / /_ ______ / /__ (_)___/ /_ __';
echo ' / ___/ __ \/ / / / / __ \/ //_/ / / __ / |/_/';
echo ' (__ ) /_/ / / /_/ / / / / ,< / / /_/ /> < ';
echo '/____/ .___/_/\__,_/_/ /_/_/|_| /_/\__,_/_/|_| ';
echo ' /_/ ';
echo -e "\e[0m\n";
echo -e "\e[1;4;92mSHORTCUTS\e[0m \n";
echo -e "\e[38;5;198mc2sh\e[0m = ${BASH_ALIASES[c2sh]}";
echo -e "\e[38;5;198mc2e\e[0m = ${BASH_ALIASES[c2e]}";
echo -e "\e[38;5;198mc2sl\e[0m = ${BASH_ALIASES[c2sl]}";
echo -e "\e[38;5;198mc2s\e[0m = ${BASH_ALIASES[c2s]}";
echo "";
echo -e "\e[38;5;198mscli\e[0m = ${BASH_ALIASES[scli]}";
echo -e "\e[38;5;198msssp\e[0m = ${BASH_ALIASES[sssp]}";
echo -e "\e[38;5;198msssn\e[0m = ${BASH_ALIASES[sssn]}";
echo -e "\e[38;5;198mssdh\e[0m = ${BASH_ALIASES[ssdh]}";
echo "";
echo -e "\e[38;5;198mssg\e[0m = ${BASH_ALIASES[ssg]}";
echo -e "\e[38;5;198mlsg\e[0m = ${BASH_ALIASES[lsg]}";
echo -e "\e[38;5;198me\e[0m = ${BASH_ALIASES[e]}";