1 # oracle_prereqs.pp - This file contains configuration steps that are 2 # necessary to perform before installing Oracle 3 # 4 # NOTE: Only tested with Oracle 10.2.0 on CentOS 5.0 for now 5 # 6 # Copyright 2007 Barak Korren 7 # 8 # This program is free software: you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License as published by 10 # the Free Software Foundation, either version 3 of the License, or 11 # (at your option) any later version. 12 # 13 # This program is distributed in the hope that it will be useful, 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 # GNU General Public License for more details. 17 # 18 # You should have received a copy of the GNU General Public License 19 # along with this program. If not, see <http://www.gnu.org/licenses/>. 20 # 21 22 import "line.pp" 23 24 class oracle_req_packages { 25 # Only tested with CentOS 5.0 for now 26 package { 27 "binutils": ensure => installed; 28 "compat-db": ensure => installed; 29 "compat-libstdc++-296": ensure => installed; 30 "compat-libstdc++-33": ensure => installed; 31 "control-center": ensure => installed; 32 "gcc": ensure => installed; 33 "gcc-c++": ensure => installed; 34 "compat-gcc-34": ensure => installed; 35 "compat-gcc-34-c++": ensure => installed; 36 "glibc": ensure => installed; 37 "glibc-common": ensure => installed; 38 "libstdc++": ensure => installed; 39 "libstdc++-devel": ensure => installed; 40 "make": ensure => installed; 41 "ksh": ensure => installed; 42 "sysstat": ensure => installed; 43 "setarch": ensure => installed; 44 "openmotif": ensure => installed; 45 "libaio": ensure => installed; 46 "libXp": ensure => installed; 47 } 48 } 49 50 class oracle_user { 51 group { 52 "oinstall": 53 gid => "500", 54 allowdupe => false; 55 "dba": 56 gid => "501", 57 allowdupe => false; 58 "oper": 59 gid => "502", 60 allowdupe => false; 61 } 62 user { "oracle": 63 uid => "500", 64 gid => "oinstall", 65 managehome => true, 66 groups => [ "oinstall", "dba", "oper" ], 67 allowdupe => false, 68 } 69 } 70 71 class oracle_kernel_params { 72 # "exec" resource to update running kernel from /etc/sysctl.conf 73 exec { "load-sysctl": 74 command => "/sbin/sysctl -p", 75 refreshonly => true, 76 } 77 # Trigger updating the kernel whenever a parameter changes 78 Sysctl { notify => Exec[load-sysctl] } 79 # NOTE: Only tested with CentOS 5.0 for now 80 # TODO: make this smarter (look at machine's memory size, etc.) 81 sysctl { 82 # CentOS seems to get shmall and shmmax right by default, and 83 # I'm too lazy to figure out how to make puppet calculate the 84 # right values right now 85 #"kernel.shmall": val => "2147483648"; 86 #"kernel.shmmax": val => "2147483648"; 87 "kernel.sem": val => "250 32000 100 128"; 88 "kernel.shmmni": val => "4096"; 89 "fs.file-max": val => "65536"; 90 "net.ipv4.ip_local_port_range": val => "1024 65000"; 91 "net.core.rmem_default": val => "1048576"; 92 "net.core.rmem_max": val => "1048576"; 93 "net.core.wmem_default": val => "262144"; 94 "net.core.wmem_max": val => "262144"; 95 } 96 } 97 98 define oracle_base_dir { 99 file { 100 # Since I give it a fixed name here, you can only have one 101 # oracle_base_dir resource per machine 102 "oracle_base": 103 path => "$name", 104 ensure => directory, 105 owner => "oracle", 106 group => "oinstall", 107 mode => "755", 108 require => Class[oracle_user]; 109 "/etc/profile.d/oracle_base.sh": 110 ensure => file, 111 owner => root, 112 group => root, 113 mode => "755", 114 content => template("oracle_base.sh.erb"), 115 require => File["oracle_base"]; 116 "/etc/profile.d/oracle_base.csh": 117 ensure => file, 118 owner => root, 119 group => root, 120 mode => "755", 121 content => template("oracle_base.csh.erb"), 122 require => File["oracle_base"]; 123 } 124 } 125 126 class oracle_ulimits { 127 Line { file => "/etc/security/limits.conf" } 128 line { 129 "limit oracle soft nproc": line => "oracle soft nproc 2047"; 130 "limit oracle hard nproc": line => "oracle hard nproc 16384"; 131 "limit oracle soft nofile": line => "oracle soft nofile 1024"; 132 "limit oracle hard nofile": line => "oracle hard nofile 65536"; 133 } 134 file { 135 "/etc/profile.d/oracle_limits.sh": 136 ensure => file, 137 owner => root, 138 group => root, 139 mode => "755", 140 content => template("oracle_limits.sh.erb"), 141 require => File["oracle_base"]; 142 "/etc/profile.d/oracle_limits.csh": 143 ensure => file, 144 owner => root, 145 group => root, 146 mode => "755", 147 content => template("oracle_limits.csh.erb"), 148 require => File["oracle_base"]; 149 } 150 } 151 152 class oracle_102db_prereqs { 153 include oracle_req_packages 154 include oracle_user 155 include oracle_kernel_params 156 include oracle_ulimits 157 file { "/opt/app": 158 ensure => directory, 159 owner => root, 160 group => root, 161 mode => "755", 162 } 163 oracle_base_dir { "/opt/app/oracle": } 164 } 165