| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- # == Define: oradb::opatch
- #
- # installs oracle patches for Oracle products
- #
- #
- # === Examples
- # oradb::opatch{'14727310_db_patch':
- # oracleProductHome => '/oracle/product/11.2/db',
- # patchId => '14727310',
- # patchFile => 'p14727310_112030_Linux-x86-64.zip',
- # user => 'oracle',
- # group => 'dba',
- # downloadDir => '/install',
- # ocmrf => 'true',
- # require => Class['oradb::installdb'],
- # }
- #
- #
- define oradb::opatch( $oracleProductHome = undef,
- $patchId = undef,
- $patchFile = undef,
- $user = 'oracle',
- $group = 'dba',
- $downloadDir = '/install',
- $ocmrf = false,
- $puppetDownloadMntPoint = undef,
- $remoteFile = true,
- )
- {
- case $::kernel {
- 'Linux', 'SunOS': {
- $execPath = '/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:'
- $path = $downloadDir
- Exec { path => $execPath,
- user => $user,
- group => $group,
- logoutput => true,
- }
- File {
- ensure => present,
- mode => 0775,
- owner => $user,
- group => $group,
- }
- }
- default: {
- fail("Unrecognized operating system")
- }
- }
- case $::kernel {
- 'Linux': {
- $oraInstPath = "/etc"
- }
- 'SunOS': {
- $oraInstPath = "/var/opt"
- }
- default: {
- fail("Unrecognized operating system ${::kernel}, please use it on a Linux host")
- }
- }
- if $puppetDownloadMntPoint == undef {
- $mountPoint = "puppet:///modules/oradb/"
- } else {
- $mountPoint = $puppetDownloadMntPoint
- }
- if $remoteFile == true {
- # the patch used by the opatch
- if ! defined(File["${path}/${patchFile}"]) {
- file { "${path}/${patchFile}":
- source => "${mountPoint}/${patchFile}",
- }
- }
- }
- case $::kernel {
- 'Linux', 'SunOS': {
- if $remoteFile == true {
- exec { "extract opatch ${patchFile} ${title}":
- command => "unzip -n ${path}/${patchFile} -d ${path}",
- require => File ["${path}/${patchFile}"],
- creates => "${path}/${patchId}",
- }
- } else {
- exec { "extract opatch ${patchFile} ${title}":
- command => "unzip -n ${mountPoint}/${patchFile} -d ${path}",
- creates => "${path}/${patchId}",
- }
- }
- if $ocmrf == true {
- db_opatch{ $patchId:
- ensure => present,
- os_user => $user,
- oracle_product_home_dir => $oracleProductHome,
- orainst_dir => $oraInstPath,
- extracted_patch_dir => "${path}/${patchId}",
- ocmrf_file => "${oracleProductHome}/OPatch/ocm.rsp",
- require => Exec["extract opatch ${patchFile} ${title}"],
- }
- } else {
- db_opatch{ $patchId:
- ensure => present,
- os_user => $user,
- oracle_product_home_dir => $oracleProductHome,
- orainst_dir => $oraInstPath,
- extracted_patch_dir => "${path}/${patchId}",
- require => Exec["extract opatch ${patchFile} ${title}"],
- }
- }
- }
- default: {
- fail("Unrecognized operating system")
- }
- }
- }
|