Newer
Older
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
#
# Handles an Oracle database system. All of our Oracle databases are run
# essentially the same way and this module contains all the standard bits.
# TODO: parameterized class for Oracle versions (10 and 11).
class oracledb {
# TODO: change to include each individual class, no commas
include compatlibs,
group::dba,
base::libstdc,
oracledb::directories,
oracledb::packages,
oracledb::oracleusers,
user::ntirety,
user::oracle
# TODO: since this is only RH specific, just fail on non-RH instead of large case statement.
case $operatingsystem {
'redhat': {
case $lsbmajdistrelease {
# rhel4 only required packages
# need to add openmotif .
'4': {
# TODO: switch to array of packages
package {
'glibc-kernheaders': ensure => present;
'gnome-libs': ensure => present;
'openmotif21': ensure => present;
'pdksh': ensure => present;
'xorg-x11-deprecated-libs': ensure => present;
'xscreensaver': ensure => present;
}
# TODO: verify <name>.ARCH doesn't work on RHEL4 with puppet now
# install i386 RPM
exec {
' oracle 64 bit server required compat-db':
command => 'up2date --arch=i386 compat-db',
unless => "rpm -q --qf \"%{ARCH}\n\" compat-db | grep -q i386";
'oracle 64bit server required glibc-devel':
command => 'up2date --arch=i386 glibc-devel',
unless => "rpm -q --qf \"%{ARCH}\n\" glibc-devel | grep -q i386";
'oracle 64bit server required libaio':
command => 'up2date --arch=i386 libaio',
unless => "rpm -q --qf \"%{ARCH}\n\" libaio | grep -q i386";
}
# TODO: verify this is needed on all RHEL versions - might not be needed on RHEL5/6
# TODO: verify this should be different than RHEL5/6 - goal: unify
base::sysctl { "net.ipv4.ip_local_port_range": ensure => "1024 65000" }
# Override limits.conf to increase stack size and nofiles.
file { '/etc/security/limits.conf':
source => $architecture ? {
'x86_64' => "puppet:///oracledb/etc/limits.conf.$architecture",
default => 'puppet:///oracledb/etc/limits.conf',
}
}
}
## this is for rhel5
'5': {
include oracledb::rhel5
file {'/etc/security/limits.conf':
source => "puppet:///oracledb/etc/limits.conf.rhel5"
}
base::sysctl { "net.ipv4.ip_local_port_range": ensure => "9000 65500" }
}
}
}
}
base::sysctl {
'kernel.shmmax': ensure => '4294967295';
'kernel.sem': ensure => '250 32000 100 128';
'kernel.shmall': ensure => '2097152';
'kernel.shmmni': ensure => '4096';
'fs.file-max': ensure => '65536';
# 'net.ipv4.ip_local_port_range': ensure => '1024 65000';
'net.core.rmem_default': ensure => '262144';
'net.core.rmem_max': ensure => '262144';
'net.core.wmem_default': ensure => '262144';
'net.core.wmem_max': ensure => '262144';
}
# Drop in iptables rules to allow connections in to the listeners
#iptables::fragment { 'oracle-listeners': ensure => present }
base::iptables::rule { 'oracle-listeners':
protocol => 'tcp',
source => [ '171.64.0.0/14',
'172.24.0.0/14',
'192.168.220.96/19',
'192.168.15.0/24'],
port => ['1533','1534','1535','1568','1542'],
}
# init script and filter-syslog rules for oracle
file {
'/etc/init.d/oracle':
source => 'puppet:///oracledb/oracle.init',
mode => 755,
notify => Exec['chkconfig oracle'];
'/etc/filter-syslog/oracle':
source => 'puppet:///oracledb/filter-syslog';
}
# TODO: use service - don't ensure running, just enabled
exec { 'chkconfig oracle':
command => 'chkconfig --add oracle',
refreshonly => true,
}
# TODO: Cleanup leftover bits
# Override limits.conf to increase stack size and nofiles.
#file { '/etc/security/limits.conf':
# source => $architecture ? {
# 'x86_64' => "puppet:///oracledb/etc/limits.conf.$architecture",
# default => 'puppet:///oracledb/etc/limits.conf',
# }
#}
}
# TODO: separate out into own file because:
# - it doesn't inherit/override from another class
# - and it is used outside this one class (well, not true here)
# - or if it is longer than ~10 lines
#
# It is all about logical separation.
# Is it easier to understand if you separate it into another file?
class oracledb::packages {
# TODO: convert to array of packages
package {
'binutils': ensure => present;
'control-center': ensure => present;
'gcc': ensure => present;
'gcc-c++': ensure => present;
'glibc': ensure => present;
'glibc-common': ensure => present;
'glibc-devel': ensure => present;
'glibc-headers': ensure => present;
'libgcc': ensure => present;
'libaio': ensure => present;
'make': ensure => present;
# 'pdksh': ensure => present;
'sysstat': ensure => present;
# 'stanford-TDPO': ensure => present;
# 'TDP-Oracle': ensure => present;
# 'TDP-Oracle.Utility': ensure => present;
'xorg-x11-xauth': ensure => present;
}
## tpdo rpms exist in rhel4 and rhel5. Need to create 64bits tdpo rpms for rhel6
## install tdpo by hand in rhel6
case $lsbmajdistrelease {
"4","5" : {
package { [
'stanford-TDPO',
'TDP-Oracle',
'TDP-Oracle.Utility'
]:
ensure => present,
}
}
# rhel6 will give you an error if tdp BIN file not installed
default: {
exec { 'check el6 tdp bin installed':
command => 'echo TDP is not installed! Install it by hand from \
/afs/ir/product/storage/TDPO_LINUX_LATEST',
unless => 'ls /opt/tivoli/tsm/client/oracle/properties/version/TSM_Data_Protection_Oracle.cmptag',
}
}
}
}
# TODO: separate file for this class
# TODO: use array for files
class oracledb::directories {
# additional directories usually needed
file {
'/var/opt/oracle':
ensure => directory,
owner => 'oracle',
group => 'dba',
mode => 770;
'/u02':
ensure => directory,
owner => 'oracle',
group => 'dba',
mode => 770;
'/u03':
ensure => directory,
owner => 'oracle',
group => 'dba',
mode => 770;
'/u01/app/rman':
ensure => directory,
owner => 'oracle',
group => 'dba',
mode => 770
}
}
# TODO: separate out to another file
class oracledb::oracleusers {
include oracledb::ntirety
# Standard sudoers file for Oracle DBAs.
# TODO: long term strategy is to use /etc/sudoers.d fragments
base::textline {
'%dba ALL = NOPASSWD: /usr/bin/dsmc q se':
ensure => "/etc/sudoers";
'oracle ALL= NOPASSWD: /usr/bin/tdpoconf PassWord *':
escaped_name => 'oracle ALL= NOPASSWD: /usr/bin/tdpoconf PassWord \*',
ensure => "/etc/sudoers";
}
k5login {
'/u01/app/oracle/.k5login':
purge => true,
principals => $oracledb::ntirety::ntiretyusers,
}
}