installosb.pp 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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. $remoteFile = true,
  51. $puppetDownloadMntPoint = undef,
  52. ) {
  53. case $operatingsystem {
  54. CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES: {
  55. $execPath = "/usr/java/${fullJDKName}/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:"
  56. $path = $downloadDir
  57. $osbOracleHome = "${mdwHome}/Oracle_OSB1"
  58. $oraInventory = "${oracleHome}/oraInventory"
  59. $osbInstallDir = "linux64"
  60. $jreLocDir = "/usr/java/${fullJDKName}"
  61. Exec { path => $execPath,
  62. user => $user,
  63. group => $group,
  64. logoutput => true,
  65. }
  66. File {
  67. ensure => present,
  68. mode => 0775,
  69. owner => $user,
  70. group => $group,
  71. backup => false,
  72. }
  73. }
  74. Solaris: {
  75. $execPath = "/usr/jdk/${fullJDKName}/bin/amd64:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:"
  76. $path = $downloadDir
  77. $osbOracleHome = "${mdwHome}/Oracle_OSB1"
  78. $oraInventory = "${oracleHome}/oraInventory"
  79. $osbInstallDir = "intelsolaris"
  80. $jreLocDir = "/usr/jdk/${fullJDKName}"
  81. Exec { path => $execPath,
  82. user => $user,
  83. group => $group,
  84. logoutput => true,
  85. }
  86. File {
  87. ensure => present,
  88. mode => 0775,
  89. owner => $user,
  90. group => $group,
  91. backup => false,
  92. }
  93. }
  94. windows: {
  95. $execPath = "C:\\oracle\\${fullJDKName}\\bin;C:\\unxutils\\bin;C:\\unxutils\\usr\\local\\wbin;C:\\Windows\\system32;C:\\Windows"
  96. $checkCommand = "C:\\Windows\\System32\\cmd.exe /c"
  97. $path = $downloadDir
  98. $osbOracleHome = "${mdwHome}/Oracle_OSB1"
  99. Exec { path => $execPath,
  100. }
  101. File { ensure => present,
  102. mode => 0555,
  103. backup => false,
  104. }
  105. }
  106. }
  107. # check if the osb already exists
  108. $found = oracle_exists( $osbOracleHome )
  109. if $found == undef {
  110. $continue = true
  111. } else {
  112. if ( $found ) {
  113. $continue = false
  114. } else {
  115. notify {"wls::installosb ${title} ${osbOracleHome} does not exists":}
  116. $continue = true
  117. }
  118. }
  119. if ( $continue ) {
  120. if $puppetDownloadMntPoint == undef {
  121. $mountPoint = "puppet:///modules/wls/"
  122. } else {
  123. $mountPoint = $puppetDownloadMntPoint
  124. }
  125. if $oepeHome == undef {
  126. $osbTemplate = "wls/silent_osb.xml.erb"
  127. } else {
  128. $osbTemplate = "wls/silent_osb_oepe.xml.erb"
  129. }
  130. wls::utils::orainst{'create osb oraInst':
  131. oraInventory => $oraInventory,
  132. group => $group,
  133. }
  134. # if ! defined(File["${path}/${title}silent_osb.xml"]) {
  135. file { "${path}/${title}silent_osb.xml":
  136. ensure => present,
  137. content => template($osbTemplate),
  138. require => Wls::Utils::Orainst ['create osb oraInst'],
  139. }
  140. # }
  141. # weblogic generic installer zip
  142. if $remoteFile == true {
  143. file { "${path}/${osbFile}":
  144. source => "${mountPoint}/${osbFile}",
  145. require => File ["${path}/${title}silent_osb.xml"],
  146. }
  147. }
  148. $command = "-silent -response ${path}/${title}silent_osb.xml -waitforcompletion "
  149. case $operatingsystem {
  150. CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES: {
  151. if $remoteFile == true {
  152. exec { "extract ${osbFile}":
  153. command => "unzip ${path}/${osbFile} -d ${path}/osb",
  154. require => [File ["${path}/${osbFile}"],
  155. File ["${path}/${title}silent_osb.xml"]],
  156. creates => "${path}/osb",
  157. }
  158. } else {
  159. exec { "extract ${osbFile}":
  160. command => "unzip ${mountPoint}/${osbFile} -d ${path}/osb",
  161. require => File ["${path}/${title}silent_osb.xml"],
  162. creates => "${path}/osb",
  163. }
  164. }
  165. exec { "install osb ${title}":
  166. command => "${path}/osb/Disk1/install/${osbInstallDir}/runInstaller ${command} -invPtrLoc /etc/oraInst.loc -ignoreSysPrereqs -jreLoc ${jreLocDir}",
  167. require => [File ["${path}/${title}silent_osb.xml"],
  168. Exec["extract ${osbFile}"]],
  169. creates => $osbOracleHome,
  170. timeout => 0,
  171. }
  172. }
  173. Solaris: {
  174. if $remoteFile == true {
  175. exec { "extract ${osbFile}":
  176. command => "unzip ${path}/${osbFile} -d ${path}/osb",
  177. require => [File ["${path}/${osbFile}"],File ["${path}/${title}silent_osb.xml"]],
  178. creates => "${path}/osb",
  179. }
  180. } else {
  181. exec { "extract ${osbFile}":
  182. command => "unzip ${mountPoint}/${osbFile} -d ${path}/osb",
  183. require => File ["${path}/${title}silent_osb.xml"],
  184. creates => "${path}/osb",
  185. }
  186. }
  187. exec { "add -d64 oraparam.ini osb":
  188. 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",
  189. # 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",
  190. require => Exec["extract ${osbFile}"],
  191. }
  192. exec { "install osb ${title}":
  193. command => "${path}/osb/Disk1/install/${osbInstallDir}/runInstaller ${command} -invPtrLoc /var/opt/oraInst.loc -ignoreSysPrereqs -jreLoc ${jreLocDir}",
  194. require => [File ["${path}/${title}silent_osb.xml"],Exec["extract ${osbFile}"],Exec["add -d64 oraparam.ini osb"]],
  195. creates => $osbOracleHome,
  196. timeout => 0,
  197. }
  198. # fix opatch bug with d64 param on jdk x64
  199. exec { "chmod ${osbOracleHome}/OPatch/opatch first":
  200. command => "chmod 775 ${osbOracleHome}/OPatch/opatch",
  201. require => Exec ["install osb ${title}"], }
  202. exec { "add quotes for d64 param in ${osbOracleHome}/OPatch/opatch":
  203. 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",
  204. require => Exec ["chmod ${osbOracleHome}/OPatch/opatch first"],
  205. }
  206. exec { "chmod ${osbOracleHome}/OPatch/opatch after":
  207. command => "chmod 775 ${osbOracleHome}/OPatch/opatch",
  208. require => Exec ["add quotes for d64 param in ${osbOracleHome}/OPatch/opatch"],
  209. }
  210. }
  211. windows: {
  212. if $remoteFile == true {
  213. exec { "extract ${osbFile}":
  214. command => "${checkCommand} unzip ${path}/${osbFile} -d ${path}/osb",
  215. require => File ["${path}/${osbFile}"],
  216. creates => "${path}/osb/Disk1",
  217. cwd => $path,
  218. }
  219. } else {
  220. exec { "extract ${osbFile}":
  221. command => "${checkCommand} unzip ${mountPoint}/${osbFile} -d ${path}/osb",
  222. creates => "${path}/osb/Disk1",
  223. cwd => $path,
  224. }
  225. }
  226. exec {"icacls osb disk ${title}":
  227. command => "${checkCommand} icacls ${path}\\osb\\* /T /C /grant Administrator:F Administrators:F",
  228. logoutput => false,
  229. require => Exec["extract ${osbFile}"],
  230. }
  231. exec { "install osb ${title}":
  232. command => "${path}\\osb\\Disk1\\setup.exe ${command} -ignoreSysPrereqs -jreLoc C:\\oracle\\${fullJDKName}",
  233. logoutput => true,
  234. require => [Exec["icacls osb disk ${title}"],File ["${path}/${title}silent_osb.xml"],Exec["extract ${osbFile}"]],
  235. creates => $osbOracleHome,
  236. timeout => 0,
  237. }
  238. }
  239. }
  240. }
  241. }