installwebtier.pp 8.0 KB

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