add directories resource to database server class
[oracle_puppet.git] / modules / oracle / manifests / database_server.pp
blobac4b2ce00f6bdf3fa47d0af699871965be1ba0a2
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 $oracle_base_path = "/opt/applications/oracle"
28 oracle_dir {
29 "oracle_base":
30 path => $oracle_base_path,
31 ensure => directory,
32 owner => "oracle",
33 group => "oinstall",
34 before => [
35 File["oracle_home"],
36 File["oracle_major_version"],
37 File["oracle_version"]
39 require => File["/opt/applications"],
40 mode => 755
43 oracle_dir {
44 "oracle_major_version":
45 path => "${oracle_base_path}/${oracle_major_version}",
46 ensure => directory,
47 owner => "oracle",
48 group => "oinstall",
49 require => File["oracle_base"],
50 before => [
51 File["oracle_home"],
52 File["oracle_version"]
54 mode => 755
57 oracle_dir {
58 "oracle_version":
59 path => "${oracle_base_path}/${oracle_major_version}/${oracle_version}",
60 ensure => directory,
61 owner => "oracle",
62 group => "oinstall",
63 require => [
64 File["oracle_base"],
65 File["oracle_major_version"]
67 before => File["oracle_home"] ,
68 mode => 755
71 oracle_dir {
72 "oracle_home":
73 path => "${oracle_base_path}/${oracle_major_version}/${oracle_version}/${oracle_patch_version}",
74 ensure => directory,
75 owner => "oracle",
76 group => "oinstall",
77 require => [
78 File["oracle_base"],
79 File["oracle_major_version"],
80 File["oracle_version"]
82 mode => 755
85 oracle_dir {
86 "oracle_data":
87 path => "/data/oracle",
88 ensure => directory,
89 owner => "oracle",
90 group => "dba",
91 require => File["/data"],
92 mode => 755
95 oracle_dir {
96 "oracle_oralogs":
97 path => "/data/oracle/oralogs",
98 ensure => directory,
99 owner => "oracle",
100 group => "dba",
101 require => File["oracle_data"],
102 mode => 755
105 oracle_dir {
106 "oracle_oralogs_${oracle_sid}":
107 path => "/data/oracle/oralogs/${oracle_sid}",
108 ensure => directory,
109 owner => "oracle",
110 group => "dba",
111 require => File["oracle_oralogs"],
112 before => [
113 File["oracle_oralogs_redo"],
114 File["oracle_oralogs_ctl"],
115 File["oracle_oralogs_arch"]
117 mode => 755
120 oracle_dir{
121 "oracle_oralogs_redo":
122 path => "/data/oracle/oralogs/${oracle_sid}/redo",
123 ensure => directory,
124 owner => "oracle",
125 group => "dba",
126 require => File["oracle_oralogs_${oracle_sid}"],
127 mode => 755
130 oracle_dir{
131 "oracle_oralogs_ctl":
132 path => "/data/oracle/oralogs/${oracle_sid}/ctl",
133 ensure => directory,
134 owner => "oracle",
135 group => "dba",
136 require => File["oracle_oralogs_${oracle_sid}"],
137 mode => 755
140 oracle_dir{
141 "oracle_oralogs_arch":
142 path => "/data/oracle/oralogs/${oracle_sid}/arch",
143 ensure => directory,
144 owner => "oracle",
145 group => "dba",
146 require => File["oracle_oralogs_${oracle_sid}"],
147 mode => 755
150 oracle_dir {
151 "oracle_oradata":
152 path => "/data/oracle/oradata",
153 ensure => directory,
154 owner => "oracle",
155 group => "dba",
156 require => File["oracle_data"],
157 before => File["oracle_oradata_${oracle_sid}"],
158 mode => 755
161 oracle_dir {
162 "oracle_oradata_${oracle_sid}":
163 path => "/data/oracle/oradata/${oracle_sid}",
164 ensure => directory,
165 owner => "oracle",
166 group => "dba",
167 require => File["oracle_oradata"],
168 mode => 755
172 oracle_dir {
173 "oracle_logs":
174 path => "/logs/oracle",
175 ensure => directory,
176 owner => "oracle",
177 group => "dba",
178 require => File["/logs"],
179 mode => 755,
180 before => [
181 File["oracle_dumps"],
182 File["oracle_user_dumps"],
183 File["oracle_background_dumps"],
184 File["oracle_audit_dumps"],
185 File["oracle_core_dumps"]
189 oracle_dir {
190 "oracle_dumps":
191 path => "/logs/oracle/oradumps",
192 ensure => directory,
193 owner => "oracle",
194 group => "dba",
195 require => File["oracle_logs"],
196 before => [
197 File["oracle_user_dumps"],
198 File["oracle_background_dumps"],
199 File["oracle_audit_dumps"],
200 File["oracle_core_dumps"],
201 File["oracle_pfile_dir"],
202 File["oracle_dumps_${oracle_sid}"]
203 ] ,
204 mode => 755
207 oracle_dir {
208 "oracle_dumps_${oracle_sid}":
209 path => "/logs/oracle/oradumps/${oracle_sid}",
210 ensure => directory,
211 owner => "oracle",
212 group => "dba",
213 require => File["oracle_dumps"],
214 before => [
215 File["oracle_user_dumps"],
216 File["oracle_background_dumps"],
217 File["oracle_audit_dumps"],
218 File["oracle_core_dumps"],
219 File["oracle_pfile_dir"]
221 mode => 755
224 oracle_dir {
225 "oracle_user_dumps":
226 path => "/logs/oracle/oradumps/${oracle_sid}/udump",
227 ensure => directory,
228 owner => "oracle",
229 group => "dba",
230 require => File["oracle_dumps_${oracle_sid}"],
231 mode => 755
234 oracle_dir {
235 "oracle_background_dumps":
236 path => "/logs/oracle/oradumps/${oracle_sid}/bdump",
237 ensure => directory,
238 owner => "oracle",
239 group => "dba",
240 require => File["oracle_dumps_${oracle_sid}"],
241 mode => 755
244 oracle_dir {
245 "oracle_audit_dumps":
246 path => "/logs/oracle/oradumps/${oracle_sid}/adump",
247 ensure => directory,
248 owner => "oracle",
249 group => "dba",
250 require => File["oracle_dumps_${oracle_sid}"],
251 mode => 755
254 oracle_dir {
255 "oracle_core_dumps":
256 path => "/logs/oracle/oradumps/${oracle_sid}/cdump",
257 ensure => directory,
258 owner => "oracle",
259 group => "dba",
260 require => File["oracle_dumps_${oracle_sid}"],
261 mode => 755
264 oracle_dir {
265 "oracle_pfile_dir":
266 path => "/logs/oracle/oradumps/${oracle_sid}/pfile",
267 ensure => directory,
268 owner => "oracle",
269 group => "dba",
270 require => File["oracle_dumps_${oracle_sid}"],
271 mode => 755
275 define oracle_dir ( $path, $ensure, $owner, $group, $mode ) {
276 file {
277 $name:
278 path => $path,
279 ensure => $ensure,
280 force => true,
281 owner => $owner,
282 group => $group,
283 recurse => 5,
284 mode => $mode
290 class oracle::database_server::system_packages {
292 case $operatingsystem {
293 "solaris": {
294 $sun_provider = "sun"
295 case $oracle_major_version {
296 "10g": {
297 case $architecture {
298 "sparc64": {
299 $system_packages = ["SUNWarc", "SUNWbtool", "SUNWhea", "SUNWlibm", "SUNWlibms", "SUNWsprot", "SUNWtoo", "SUNWi1of", "SUNWi1cs", "SUNWi15cs", "SUNWxwfnt", "SUNWsprox"]
301 "sparc32": {
302 $system_packages = ["SUNWarc", "SUNWbtool", "SUNWhea", "SUNWlibm", "SUNWlibms", "SUNWsprot", "SUNWtoo", "SUNWi1of", "SUNWi1cs", "SUNWi15cs", "SUNWxwfnt"]
304 default: {
305 fail("oracle::database_server - the architecture $architecture is not
306 yet supported by class system_packages.")
310 "9i": {
311 case $architecture {
312 "sparc64": {
313 $system_packages = ["SUNWarc", "SUNWbtool", "SUNWhea", "SUNWlibm", "SUNWlibms", "SUNWsprot", "SUNWtoo", "SUNWi1of", "SUNWxwfnt"]
315 "sparc32": {
316 $system_packages = ["SUNWarc", "SUNWbtool", "SUNWhea", "SUNWlibm", "SUNWlibms", "SUNWsprot", "SUNWtoo", "SUNWi1of", "SUNWxwfnt"]
319 default: {
320 fail("oracle::database_server - the architecture $architecture is not
321 yet supported by class system_packages.")
326 default: {
327 fail("oracle::database_server - the oracle version $oracle_major_version is not
328 yet support by class system_packages.")
332 default: {
333 fail("oracle::database_server - the operating system $operatingsystem is not
334 yet supported by class system_packages.")
339 notify {"oracle::database_server - the operating system is ${operatingsystem}": }
340 notify {"oracle::database_server - the architecture is ${architecture}": }
341 notify {"oracle::database_server - the architecture is ${oracle_major_version}": }
342 notify {"oracle::database_server - the list of packages required is ${system_packages}": }
344 package { $ystem_packages: ensure => installed, provider => $sun_provider }