add the operating system profile
[oracle_puppet.git] / modules / oracle / manifests / database_server.pp
blobc456e4dda838947037122476db6876037cc191f3
1 # database_server.pp - oracle database server software 9i/10g
3 # Copyright (C) 2009 Jeremy Baumont
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 class oracle::database_server {
20 # required user and groups
21 include oracle::administrators
23 # required packages
24 include oracle::database_server::system_packages
26 # required directories
27 include oracle::database_server::directories
29 # required system profile
30 include oracle::database_server::system_profile
32 } # end of class oracle::database_server
35 class oracle::database_server::system_profile {
38 define oracle_system_profile ($oracle_base_path, $oracle_version,
39 $oracle_home_path, $oracle_sid,
40 $oracle_dumps, $oracle_oralogs) {
41 file {
42 $name:
43 content => template("oracle/bash_profile.oracle-template.erb")
47 oracle_system_profile {
48 "/users/oracle/.bash_profile.oracle":
49 oracle_base_path =>
50 $oracle::database_server::directories::oracle_base_path,
51 oracle_version =>
52 $oracle::database_server::directories::oracle_version, oracle_home_path =>
53 $oracle::database_server::directories::oracle_home_path,
54 oracle_sid =>
55 $oracle::database_server::directories::oracle_sid, oracle_dumps =>
56 $oracle::database_server::directories::oracle_dumps,
57 oracle_oralogs =>
58 $oracle::database_server::directories::oracle_oralogs
60 } # end of class oracle::database_server::system_profile
63 class oracle::database_server::directories {
66 define oracle_dir ( $path, $ensure, $owner, $group, $mode ) {
67 file {
68 $name:
69 path => $path,
70 ensure => $ensure,
71 force => true,
72 owner => $owner,
73 group => $group,
74 recurse => 5,
75 mode => $mode
80 # required directories
81 $oracle_base_path = "/opt/applications/oracle"
82 oracle_dir {
83 "oracle_base":
84 path => $oracle_base_path,
85 ensure => directory,
86 owner => "oracle",
87 group => "oinstall",
88 before => [
89 File["oracle_home"],
90 File["oracle_major_version"],
91 File["oracle_version"]
93 require => File["/opt/applications"],
94 mode => 755
97 oracle_dir {
98 "oracle_major_version":
99 path => "${oracle_base_path}/${oracle_major_version}",
100 ensure => directory,
101 owner => "oracle",
102 group => "oinstall",
103 require => File["oracle_base"],
104 before => [
105 File["oracle_home"],
106 File["oracle_version"]
108 mode => 755
111 oracle_dir {
112 "oracle_version":
113 path => "${oracle_base_path}/${oracle_major_version}/${oracle_version}",
114 ensure => directory,
115 owner => "oracle",
116 group => "oinstall",
117 require => [
118 File["oracle_base"],
119 File["oracle_major_version"]
121 before => File["oracle_home"] ,
122 mode => 755
125 $oracle_home_path = "${oracle_base_path}/${oracle_major_version}/${oracle_version}/${oracle_patch_version}"
126 oracle_dir {
127 "oracle_home":
128 path => "${oracle_home_path}",
129 ensure => directory,
130 owner => "oracle",
131 group => "oinstall",
132 require => [
133 File["oracle_base"],
134 File["oracle_major_version"],
135 File["oracle_version"]
137 mode => 755
140 oracle_dir {
141 "oracle_data":
142 path => "/data/oracle",
143 ensure => directory,
144 owner => "oracle",
145 group => "dba",
146 require => File["/data"],
147 mode => 755
150 $oracle_oralogs = "/data/oracle/oralogs"
151 oracle_dir {
152 "oracle_oralogs":
153 path => "${oracle_oralogs}",
154 ensure => directory,
155 owner => "oracle",
156 group => "dba",
157 require => File["oracle_data"],
158 mode => 755
161 oracle_dir {
162 "oracle_oralogs_${oracle_sid}":
163 path => "${oracle_oralogs}/${oracle_sid}",
164 ensure => directory,
165 owner => "oracle",
166 group => "dba",
167 require => File["oracle_oralogs"],
168 before => [
169 File["oracle_oralogs_redo"],
170 File["oracle_oralogs_ctl"],
171 File["oracle_oralogs_arch"]
173 mode => 755
176 oracle_dir{
177 "oracle_oralogs_redo":
178 path => "${oracle_oralogs}/${oracle_sid}/redo",
179 ensure => directory,
180 owner => "oracle",
181 group => "dba",
182 require => File["oracle_oralogs_${oracle_sid}"],
183 mode => 755
186 oracle_dir{
187 "oracle_oralogs_ctl":
188 path => "${oracle_oralogs}/${oracle_sid}/ctl",
189 ensure => directory,
190 owner => "oracle",
191 group => "dba",
192 require => File["oracle_oralogs_${oracle_sid}"],
193 mode => 755
196 oracle_dir{
197 "oracle_oralogs_arch":
198 path => "${oracle_oralogs}/${oracle_sid}/arch",
199 ensure => directory,
200 owner => "oracle",
201 group => "dba",
202 require => File["oracle_oralogs_${oracle_sid}"],
203 mode => 755
206 oracle_dir {
207 "oracle_oradata":
208 path => "/data/oracle/oradata",
209 ensure => directory,
210 owner => "oracle",
211 group => "dba",
212 require => File["oracle_data"],
213 before => File["oracle_oradata_${oracle_sid}"],
214 mode => 755
217 oracle_dir {
218 "oracle_oradata_${oracle_sid}":
219 path => "/data/oracle/oradata/${oracle_sid}",
220 ensure => directory,
221 owner => "oracle",
222 group => "dba",
223 require => File["oracle_oradata"],
224 mode => 755
228 $oracle_logs = "/logs/oracle"
229 oracle_dir {
230 "oracle_logs":
231 path => "${oracle_logs}",
232 ensure => directory,
233 owner => "oracle",
234 group => "dba",
235 require => File["/logs"],
236 mode => 755,
237 before => [
238 File["oracle_dumps"],
239 File["oracle_user_dumps"],
240 File["oracle_background_dumps"],
241 File["oracle_audit_dumps"],
242 File["oracle_core_dumps"]
246 $oracle_dumps = "${oracle_logs}/oradumps"
247 oracle_dir {
248 "oracle_dumps":
249 path => "${oracle_dumps}",
250 ensure => directory,
251 owner => "oracle",
252 group => "dba",
253 require => File["oracle_logs"],
254 before => [
255 File["oracle_user_dumps"],
256 File["oracle_background_dumps"],
257 File["oracle_audit_dumps"],
258 File["oracle_core_dumps"],
259 File["oracle_pfile_dir"],
260 File["oracle_dumps_${oracle_sid}"]
261 ] ,
262 mode => 755
265 oracle_dir {
266 "oracle_dumps_${oracle_sid}":
267 path => "/logs/oracle/oradumps/${oracle_sid}",
268 ensure => directory,
269 owner => "oracle",
270 group => "dba",
271 require => File["oracle_dumps"],
272 before => [
273 File["oracle_user_dumps"],
274 File["oracle_background_dumps"],
275 File["oracle_audit_dumps"],
276 File["oracle_core_dumps"],
277 File["oracle_pfile_dir"]
279 mode => 755
282 oracle_dir {
283 "oracle_user_dumps":
284 path => "/logs/oracle/oradumps/${oracle_sid}/udump",
285 ensure => directory,
286 owner => "oracle",
287 group => "dba",
288 require => File["oracle_dumps_${oracle_sid}"],
289 mode => 755
292 oracle_dir {
293 "oracle_background_dumps":
294 path => "/logs/oracle/oradumps/${oracle_sid}/bdump",
295 ensure => directory,
296 owner => "oracle",
297 group => "dba",
298 require => File["oracle_dumps_${oracle_sid}"],
299 mode => 755
302 oracle_dir {
303 "oracle_audit_dumps":
304 path => "/logs/oracle/oradumps/${oracle_sid}/adump",
305 ensure => directory,
306 owner => "oracle",
307 group => "dba",
308 require => File["oracle_dumps_${oracle_sid}"],
309 mode => 755
312 oracle_dir {
313 "oracle_core_dumps":
314 path => "/logs/oracle/oradumps/${oracle_sid}/cdump",
315 ensure => directory,
316 owner => "oracle",
317 group => "dba",
318 require => File["oracle_dumps_${oracle_sid}"],
319 mode => 755
322 oracle_dir {
323 "oracle_pfile_dir":
324 path => "/logs/oracle/oradumps/${oracle_sid}/pfile",
325 ensure => directory,
326 owner => "oracle",
327 group => "dba",
328 require => File["oracle_dumps_${oracle_sid}"],
329 mode => 755
333 } # end of class oracle::database_server::directories
336 class oracle::database_server::system_packages {
338 case $operatingsystem {
339 "solaris": {
340 $sun_provider = "sun"
341 case $oracle_major_version {
342 "10g": {
343 case $architecture {
344 "sparc64": {
345 $system_packages = ["SUNWarc", "SUNWbtool", "SUNWhea", "SUNWlibm", "SUNWlibms", "SUNWsprot", "SUNWtoo", "SUNWi1of", "SUNWi1cs", "SUNWi15cs", "SUNWxwfnt", "SUNWsprox"]
347 "sparc32": {
348 $system_packages = ["SUNWarc", "SUNWbtool", "SUNWhea", "SUNWlibm", "SUNWlibms", "SUNWsprot", "SUNWtoo", "SUNWi1of", "SUNWi1cs", "SUNWi15cs", "SUNWxwfnt"]
350 default: {
351 fail("oracle::database_server - the architecture $architecture is not
352 yet supported by class system_packages.")
356 "9i": {
357 case $architecture {
358 "sparc64": {
359 $system_packages = ["SUNWarc", "SUNWbtool", "SUNWhea", "SUNWlibm", "SUNWlibms", "SUNWsprot", "SUNWtoo", "SUNWi1of", "SUNWxwfnt"]
361 "sparc32": {
362 $system_packages = ["SUNWarc", "SUNWbtool", "SUNWhea", "SUNWlibm", "SUNWlibms", "SUNWsprot", "SUNWtoo", "SUNWi1of", "SUNWxwfnt"]
365 default: {
366 fail("oracle::database_server - the architecture $architecture is not
367 yet supported by class system_packages.")
372 default: {
373 fail("oracle::database_server - the oracle version $oracle_major_version is not
374 yet support by class system_packages.")
378 default: {
379 fail("oracle::database_server - the operating system $operatingsystem is not
380 yet supported by class system_packages.")
385 notify {"oracle::database_server - the operating system is ${operatingsystem}": }
386 notify {"oracle::database_server - the architecture is ${architecture}": }
387 notify {"oracle::database_server - the architecture is ${oracle_major_version}": }
388 notify {"oracle::database_server - the list of packages required is ${system_packages}": }
390 package { $ystem_packages: ensure => installed, provider => $sun_provider }
392 } # end of class oracle::database_server::system_packages