installosb.pp 8.6 KB

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