installwebtier.pp 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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. backup => false,
  62. }
  63. }
  64. Solaris: {
  65. $execPath = "/usr/jdk/${fullJDKName}/bin/amd64:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:"
  66. $path = $downloadDir
  67. $webtierOracleHome = "${mdwHome}/Oracle_WT1"
  68. $oraInventory = "${oracleHome}/oraInventory"
  69. $webtierInstallDir = "intelsolaris"
  70. $jreLocDir = "/usr/jdk/${fullJDKName}"
  71. Exec { path => $execPath,
  72. user => $user,
  73. group => $group,
  74. logoutput => true,
  75. }
  76. File {
  77. ensure => present,
  78. mode => 0775,
  79. owner => $user,
  80. group => $group,
  81. backup => false,
  82. }
  83. }
  84. windows: {
  85. $execPath = "C:\\oracle\\${fullJDKName}\\bin;C:\\unxutils\\bin;C:\\unxutils\\usr\\local\\wbin;C:\\Windows\\system32;C:\\Windows"
  86. $checkCommand = "C:\\Windows\\System32\\cmd.exe /c"
  87. $path = $downloadDir
  88. $webtierOracleHome = "${mdwHome}/Oracle_WT1"
  89. Exec { path => $execPath,
  90. }
  91. File { ensure => present,
  92. mode => 0555,
  93. backup => false,
  94. }
  95. }
  96. }
  97. # check if the webtier already exists
  98. $found = oracle_exists( $webtierOracleHome )
  99. if $found == undef {
  100. $continue = true
  101. } else {
  102. if ( $found ) {
  103. $continue = false
  104. } else {
  105. notify {"wls::installwebtier ${title} ${webtierOracleHome} does not exists":}
  106. $continue = true
  107. }
  108. }
  109. if ( $continue ) {
  110. if $puppetDownloadMntPoint == undef {
  111. $mountPoint = "puppet:///modules/wls/"
  112. } else {
  113. $mountPoint = $puppetDownloadMntPoint
  114. }
  115. wls::utils::orainst{'create webtier oraInst':
  116. oraInventory => $oraInventory,
  117. group => $group,
  118. }
  119. if ( $version == '1111') {
  120. $webtierTemplate = "wls/silent_webtier.xml.erb"
  121. } else {
  122. fail("Unrecognized webtier installation version")
  123. }
  124. # if ! defined(File["${path}/${title}silent_webtier.xml"]) {
  125. file { "${path}/${title}silent_webtier.xml":
  126. ensure => present,
  127. content => template($webtierTemplate),
  128. require => Wls::Utils::Orainst ['create webtier oraInst'],
  129. }
  130. # }
  131. # weblogic generic installer zip
  132. if ! defined(File["${path}/${webtierFile}"]) {
  133. file { "${path}/${webtierFile}":
  134. source => "${mountPoint}/${webtierFile}",
  135. require => File ["${path}/${title}silent_webtier.xml"],
  136. }
  137. }
  138. $command = "-silent -response ${path}/${title}silent_webtier.xml -waitforcompletion "
  139. case $operatingsystem {
  140. CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES: {
  141. if ! defined(Exec["extract ${webtierFile}"]) {
  142. exec { "extract ${webtierFile}":
  143. command => "unzip ${path}/${webtierFile} -d ${path}/webtier",
  144. require => [File ["${path}/${webtierFile}"],File ["${path}/${title}silent_webtier.xml"]],
  145. creates => "${path}/webtier",
  146. }
  147. }
  148. exec { "install webtier ${title}":
  149. command => "${path}/webtier/Disk1/install/${webtierInstallDir}/runInstaller ${command} -invPtrLoc /etc/oraInst.loc -ignoreSysPrereqs -jreLoc ${jreLocDir}",
  150. require => [File ["${path}/${title}silent_webtier.xml"],Exec["extract ${webtierFile}"]],
  151. creates => $webtierOracleHome,
  152. timeout => 0,
  153. }
  154. }
  155. Solaris: {
  156. if ! defined(Exec["extract ${webtierFile}"]) {
  157. exec { "extract ${webtierFile}":
  158. command => "unzip ${path}/${webtierFile} -d ${path}/webtier",
  159. require => [File ["${path}/${webtierFile}"],File ["${path}/${title}silent_webtier.xml"]],
  160. creates => "${path}/webtier",
  161. }
  162. }
  163. exec { "add -d64 oraparam.ini webtier":
  164. 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",
  165. # 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",
  166. require => Exec["extract ${webtierFile}"],
  167. }
  168. exec { "install webtier ${title}":
  169. command => "${path}/webtier/Disk1/install/${webtierInstallDir}/runInstaller ${command} -invPtrLoc /var/opt/oraInst.loc -ignoreSysPrereqs -jreLoc ${jreLocDir}",
  170. require => [File ["${path}/${title}silent_webtier.xml"],Exec["extract ${webtierFile}"],Exec["add -d64 oraparam.ini webtier"]],
  171. creates => $webtierOracleHome,
  172. timeout => 0,
  173. }
  174. }
  175. windows: {
  176. if ! defined(Exec["extract ${webtierFile}"]) {
  177. exec { "extract ${webtierFile}":
  178. command => "${checkCommand} unzip ${path}/${webtierFile} -d ${path}/webtier",
  179. require => File ["${path}/${webtierFile}"],
  180. creates => "${path}/webtier/Disk1",
  181. cwd => $path,
  182. }
  183. }
  184. exec {"icacls webtier disk ${title}":
  185. command => "${checkCommand} icacls ${path}\\webtier\\* /T /C /grant Administrator:F Administrators:F",
  186. logoutput => false,
  187. require => Exec["extract ${webtierFile}"],
  188. }
  189. exec { "install webtier ${title}":
  190. command => "${path}\\webtier\\Disk1\\setup.exe ${command} -ignoreSysPrereqs -jreLoc C:\\oracle\\${fullJDKName}",
  191. logoutput => true,
  192. require => [Exec["icacls webtier disk ${title}"],File ["${path}/${title}silent_webtier.xml"],Exec["extract ${webtierFile}"]],
  193. creates => $webtierOracleHome,
  194. timeout => 0,
  195. }
  196. }
  197. }
  198. }
  199. }