rcu.pp 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. # == Class: oradb::rcu
  2. # rcu for soa suite, webcenter
  3. #
  4. # product = soasuite|webcenter|oim|all
  5. #
  6. # oradb::rcu{ 'DEV_PS6':
  7. # rcuFile => 'ofm_rcu_linux_11.1.1.7.0_32_disk1_1of1.zip',
  8. # version => '11.1.1.7',
  9. # oracleHome => '/oracle/product/11.2/db',
  10. # product => 'all',
  11. # user => 'oracle',
  12. # group => 'dba',
  13. # downloadDir => '/install',
  14. # action => 'create',
  15. # dbServer => 'dbagent1.alfa.local:1521',
  16. # dbService => 'test.oracle.com',
  17. # sysPassword => 'Welcome01',
  18. # schemaPrefix => 'DEV',
  19. # reposPassword => 'Welcome02',
  20. # }
  21. #
  22. #
  23. define oradb::rcu( $rcuFile = undef,
  24. $product = 'soasuite',
  25. $version = '11.1.1.7',
  26. $oracleHome = undef,
  27. $user = 'oracle',
  28. $group = 'dba',
  29. $downloadDir = '/install',
  30. $action = 'create',
  31. $dbServer = undef,
  32. $dbService = undef,
  33. $sysPassword = undef,
  34. $schemaPrefix = undef,
  35. $reposPassword = undef,
  36. $tempTablespace = undef,
  37. $puppetDownloadMntPoint = undef,
  38. $remoteFile = true,
  39. $logoutput = false,
  40. )
  41. {
  42. case $::kernel {
  43. Linux: {
  44. $execPath = "${oracleHome}/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:"
  45. }
  46. default: {
  47. fail("Unrecognized or not supported operating system")
  48. }
  49. }
  50. if $puppetDownloadMntPoint == undef {
  51. $mountPoint = "puppet:///modules/oradb/"
  52. } else {
  53. $mountPoint = $puppetDownloadMntPoint
  54. }
  55. # create the rcu folder
  56. if ! defined(File["${downloadDir}/rcu_${version}"]) {
  57. # check rcu install folder
  58. file { "${downloadDir}/rcu_${version}":
  59. ensure => directory,
  60. path => "${downloadDir}/rcu_${version}",
  61. recurse => false,
  62. replace => false,
  63. mode => '0775',
  64. owner => $user,
  65. group => $group,
  66. }
  67. }
  68. # unzip rcu software
  69. if $remoteFile == true {
  70. if ! defined(File["${downloadDir}/${rcuFile}"]) {
  71. file { "${downloadDir}/${rcuFile}":
  72. ensure => present,
  73. mode => '0775',
  74. owner => $user,
  75. group => $group,
  76. source => "${mountPoint}/${rcuFile}",
  77. before => Exec ["extract ${rcuFile}"],
  78. }
  79. }
  80. $source = $downloadDir
  81. } else {
  82. $source = $mountPoint
  83. }
  84. exec { "extract ${rcuFile}":
  85. command => "unzip ${source}/${rcuFile} -d ${downloadDir}/rcu_${version}",
  86. creates => "${downloadDir}/rcu_${version}/rcuHome",
  87. path => $execPath,
  88. user => $user,
  89. group => $group,
  90. logoutput => false,
  91. }
  92. if ! defined(File["${downloadDir}/rcu_${version}/rcuHome/rcu/log"]) {
  93. # check rcu log folder
  94. file { "${downloadDir}/rcu_${version}/rcuHome/rcu/log":
  95. ensure => directory,
  96. path => "${downloadDir}/rcu_${version}/rcuHome/rcu/log",
  97. recurse => false,
  98. replace => false,
  99. require => Exec ["extract ${rcuFile}"],
  100. mode => '0775',
  101. owner => $user,
  102. group => $group,
  103. }
  104. }
  105. if $product == 'soasuite' {
  106. $components = '-component SOAINFRA -component ORASDPM -component MDS -component OPSS -component BAM'
  107. $componentsPasswords = [$reposPassword, $reposPassword, $reposPassword,$reposPassword,$reposPassword]
  108. } elsif $product == 'webcenter' {
  109. $components = '-component MDS -component OPSS -component CONTENTSERVER11 -component CONTENTSERVER11SEARCH -component URM -component PORTLET -component WEBCENTER -component ACTIVITIES -component DISCUSSIONS'
  110. # extra password for DISCUSSIONS and ACTIVITIES
  111. $componentsPasswords = [$reposPassword, $reposPassword, $reposPassword, $reposPassword, $reposPassword, $reposPassword, $reposPassword, $reposPassword, $reposPassword, $reposPassword, $reposPassword]
  112. } elsif $product == 'oim' {
  113. $components = '-component SOAINFRA -component ORASDPM -component MDS -component OPSS -component BAM -component IAU -component OIF -component OIM -component OAM -component OAAM'
  114. $componentsPasswords = [$reposPassword, $reposPassword, $reposPassword,$reposPassword,$reposPassword,$reposPassword, $reposPassword, $reposPassword,$reposPassword, $reposPassword]
  115. } elsif $product == 'all' {
  116. $components = '-component SOAINFRA -component ORASDPM -component MDS -component OPSS -component BAM -component CONTENTSERVER11 -component CONTENTSERVER11SEARCH -component URM -component PORTLET -component WEBCENTER -component ACTIVITIES -component DISCUSSIONS'
  117. # extra password for DISCUSSIONS and ACTIVITIES
  118. $componentsPasswords = [ $reposPassword, $reposPassword, $reposPassword,$reposPassword,$reposPassword, $reposPassword, $reposPassword, $reposPassword, $reposPassword, $reposPassword, $reposPassword, $reposPassword, $reposPassword, $reposPassword]
  119. } else {
  120. fail("Unrecognized FMW product")
  121. }
  122. file { "${downloadDir}/rcu_${version}/rcu_passwords_${title}.txt":
  123. ensure => present,
  124. require => Exec ["extract ${rcuFile}"],
  125. content => template("oradb/rcu_passwords.txt.erb"),
  126. mode => '0775',
  127. owner => $user,
  128. group => $group,
  129. }
  130. $preCommand = "${downloadDir}/rcu_${version}/rcuHome/bin/rcu -silent"
  131. $postCommand = "-databaseType ORACLE -connectString ${dbServer}:${dbService} -dbUser SYS -dbRole SYSDBA -schemaPrefix ${schemaPrefix} ${components} "
  132. $passwordCommand = " -f < ${downloadDir}/rcu_${version}/rcu_passwords_${title}.txt"
  133. #optional set the Temp tablespace
  134. if $tempTablespace == undef {
  135. $createCommand = "${preCommand} -createRepository ${postCommand} ${passwordCommand}"
  136. } else {
  137. $createCommand = "${preCommand} -createRepository ${postCommand} -tempTablespace ${tempTablespace} ${passwordCommand}"
  138. }
  139. $deleteCommand = "${preCommand} -dropRepository ${postCommand} ${passwordCommand}"
  140. if $action == 'create' {
  141. $statement = $createCommand
  142. }
  143. elsif $action == 'delete' {
  144. $statement = $deleteCommand
  145. }
  146. db_rcu{ $schemaPrefix:
  147. ensure => $action,
  148. statement => $statement,
  149. os_user => $user,
  150. oracle_home => $oracleHome,
  151. sys_password => $sysPassword,
  152. db_server => $dbServer,
  153. db_service => $dbService,
  154. require => [Exec["extract ${rcuFile}"],
  155. File["${downloadDir}/rcu_${version}/rcu_passwords_${title}.txt"],],
  156. }
  157. }