installwc.pp 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. # == Define: wls::installwc
  2. #
  3. # installs Oracle Webcenter
  4. #
  5. # === Examples
  6. #
  7. # $jdkWls11gJDK = 'jdk1.7.0_09'
  8. # $wls11gVersion = "1036"
  9. #
  10. # $osMdwHome = "/opt/wls/Middleware11gR1"
  11. # $osWlHome = "/opt/wls/Middleware11gR1/wlserver_10.3"
  12. # $oracleHome = "/opt/wls/"
  13. # $user = "oracle"
  14. # $group = "dba"
  15. #
  16. #
  17. # Wls::Installwc {
  18. # mdwHome => $osMdwHome,
  19. # wlHome => $osWlHome,
  20. # fullJDKName => $jdkWls11gJDK,
  21. # user => $user,
  22. # group => $group,
  23. # }
  24. #
  25. #
  26. # wls::installwc{'wcPS6':
  27. # wcFile => 'ofm_wc_generic_11.1.1.7.0_disk1_1of1.zip',
  28. # }
  29. #
  30. ##
  31. define wls::installwc( $mdwHome = undef,
  32. $wlHome = undef,
  33. $oracleHome = undef,
  34. $fullJDKName = undef,
  35. $wcFile = undef,
  36. $user = 'oracle',
  37. $group = 'dba',
  38. $downloadDir = '/install',
  39. $puppetDownloadMntPoint = undef,
  40. ) {
  41. case $operatingsystem {
  42. CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES: {
  43. $execPath = "/usr/java/${fullJDKName}/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:"
  44. $path = $downloadDir
  45. $wcOracleHome = "${mdwHome}/Oracle_WC1"
  46. $oraInventory = "${oracleHome}/oraInventory"
  47. $wcInstallDir = "linux64"
  48. $jreLocDir = "/usr/java/${fullJDKName}"
  49. Exec { path => $execPath,
  50. user => $user,
  51. group => $group,
  52. logoutput => true,
  53. }
  54. File {
  55. ensure => present,
  56. mode => 0775,
  57. owner => $user,
  58. group => $group,
  59. }
  60. }
  61. Solaris: {
  62. $execPath = "/usr/jdk/${fullJDKName}/bin/amd64:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:"
  63. $path = $downloadDir
  64. $wcOracleHome = "${mdwHome}/Oracle_WC1"
  65. $oraInventory = "${oracleHome}/oraInventory"
  66. $wcInstallDir = "intelsolaris"
  67. $jreLocDir = "/usr/jdk/${fullJDKName}"
  68. Exec { path => $execPath,
  69. user => $user,
  70. group => $group,
  71. logoutput => true,
  72. }
  73. File {
  74. ensure => present,
  75. mode => 0775,
  76. owner => $user,
  77. group => $group,
  78. }
  79. }
  80. windows: {
  81. $execPath = "C:\\oracle\\${fullJDKName}\\bin;C:\\unxutils\\bin;C:\\unxutils\\usr\\local\\wbin;C:\\Windows\\system32;C:\\Windows"
  82. $checkCommand = "C:\\Windows\\System32\\cmd.exe /c"
  83. $path = $downloadDir
  84. $wcOracleHome = "${mdwHome}/Oracle_WC1"
  85. Exec { path => $execPath,
  86. }
  87. File { ensure => present,
  88. mode => 0555,
  89. }
  90. }
  91. }
  92. # check if the wc already exists
  93. $found = oracle_exists( $wcOracleHome )
  94. if $found == undef {
  95. $continue = true
  96. } else {
  97. if ( $found ) {
  98. $continue = false
  99. } else {
  100. notify {"wls::installwc ${title} ${$wcOracleHome} does not exists":}
  101. $continue = true
  102. }
  103. }
  104. if ( $continue ) {
  105. if $puppetDownloadMntPoint == undef {
  106. $mountPoint = "puppet:///modules/wls/"
  107. } else {
  108. $mountPoint = $puppetDownloadMntPoint
  109. }
  110. wls::utils::orainst{'create wc oraInst':
  111. oraInventory => $oraInventory,
  112. group => $group,
  113. }
  114. $wcTemplate = "wls/silent_wc.xml.erb"
  115. # if ! defined(File["${path}/${title}silent_wc.xml"]) {
  116. file { "${path}/${title}silent_wc.xml":
  117. ensure => present,
  118. content => template($wcTemplate),
  119. require => Wls::Utils::Orainst ['create wc oraInst'],
  120. }
  121. # }
  122. # weblogic generic installer zip
  123. if ! defined(File["${path}/${wcFile}"]) {
  124. file { "${path}/${wcFile}":
  125. source => "${mountPoint}/${wcFile}",
  126. require => File ["${path}/${title}silent_wc.xml"],
  127. }
  128. }
  129. $command = "-silent -response ${path}/${title}silent_wc.xml -waitforcompletion "
  130. case $operatingsystem {
  131. CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES: {
  132. if ! defined(Exec["extract ${wcFile}"]) {
  133. exec { "extract ${wcFile}":
  134. command => "unzip ${path}/${wcFile} -d ${path}/wc",
  135. require => [File ["${path}/${wcFile}"],File ["${path}/${title}silent_wc.xml"]],
  136. creates => "${path}/wc",
  137. }
  138. }
  139. exec { "install wc ${title}":
  140. command => "${path}/wc/Disk1/install/${wcInstallDir}/runInstaller ${command} -invPtrLoc /etc/oraInst.loc -ignoreSysPrereqs -jreLoc ${jreLocDir}",
  141. require => [File ["${path}/${title}silent_wc.xml"],Exec["extract ${wcFile}"]],
  142. creates => $wcOracleHome,
  143. timeout => 0,
  144. }
  145. }
  146. Solaris: {
  147. if ! defined(Exec["extract ${wcFile}"]) {
  148. exec { "extract ${wcFile}":
  149. command => "unzip ${path}/${wcFile} -d ${path}/wc",
  150. require => [File ["${path}/${wcFile}"],File ["${path}/${title}silent_wc.xml"]],
  151. creates => "${path}/wc",
  152. }
  153. }
  154. exec { "add -d64 oraparam.ini wc":
  155. command => "sed -e's/JRE_MEMORY_OPTIONS=\" -Xverify:none\"/JRE_MEMORY_OPTIONS=\"-d64 -Xverify:none\"/g' ${path}/wc/Disk1/install/${wcInstallDir}/oraparam.ini > /tmp/wc.tmp && mv /tmp/wc.tmp ${path}/wc/Disk1/install/${wcInstallDir}/oraparam.ini",
  156. require => Exec["extract ${wcFile}"],
  157. }
  158. exec { "install wc ${title}":
  159. command => "${path}/wc/Disk1/install/${wcInstallDir}/runInstaller ${command} -invPtrLoc /var/opt/oraInst.loc -ignoreSysPrereqs -jreLoc ${jreLocDir}",
  160. require => [File ["${path}/${title}silent_wc.xml"],Exec["extract ${wcFile}"],Exec["add -d64 oraparam.ini wc"]],
  161. creates => $wcOracleHome,
  162. timeout => 0,
  163. }
  164. }
  165. windows: {
  166. if ! defined(Exec["extract ${wcFile}"]) {
  167. exec { "extract ${wcFile}":
  168. command => "${checkCommand} unzip ${path}/${wcFile} -d ${path}/wc",
  169. require => File ["${path}/${wcFile}"],
  170. creates => "${path}/wc/Disk1",
  171. cwd => $path,
  172. }
  173. }
  174. exec {"icacls wc disk ${title}":
  175. command => "${checkCommand} icacls ${path}\\wc\\* /T /C /grant Administrator:F Administrators:F",
  176. logoutput => false,
  177. require => Exec["extract ${wcFile}"],
  178. }
  179. exec { "install wc ${title}":
  180. command => "${path}\\wc\\Disk1\\setup.exe ${command} -ignoreSysPrereqs -jreLoc C:\\oracle\\${fullJDKName}",
  181. logoutput => true,
  182. require => [Exec["icacls wc disk ${title}"],File ["${path}/${title}silent_wc.xml"],Exec["extract ${wcFile}"]],
  183. creates => $wcOracleHome,
  184. timeout => 0,
  185. }
  186. }
  187. }
  188. }
  189. }