installwc.pp 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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. $remoteFile = true,
  40. $puppetDownloadMntPoint = undef,
  41. ) {
  42. case $operatingsystem {
  43. CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES: {
  44. $execPath = "/usr/java/${fullJDKName}/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:"
  45. $path = $downloadDir
  46. $wcOracleHome = "${mdwHome}/Oracle_WC1"
  47. $oraInventory = "${oracleHome}/oraInventory"
  48. $wcInstallDir = "linux64"
  49. $jreLocDir = "/usr/java/${fullJDKName}"
  50. Exec { path => $execPath,
  51. user => $user,
  52. group => $group,
  53. logoutput => true,
  54. }
  55. File {
  56. ensure => present,
  57. mode => 0775,
  58. owner => $user,
  59. group => $group,
  60. backup => false,
  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. $wcOracleHome = "${mdwHome}/Oracle_WC1"
  67. $oraInventory = "${oracleHome}/oraInventory"
  68. $wcInstallDir = "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. backup => false,
  81. }
  82. }
  83. windows: {
  84. $execPath = "C:\\oracle\\${fullJDKName}\\bin;C:\\unxutils\\bin;C:\\unxutils\\usr\\local\\wbin;C:\\Windows\\system32;C:\\Windows"
  85. $checkCommand = "C:\\Windows\\System32\\cmd.exe /c"
  86. $path = $downloadDir
  87. $wcOracleHome = "${mdwHome}/Oracle_WC1"
  88. Exec { path => $execPath,
  89. }
  90. File { ensure => present,
  91. mode => 0555,
  92. backup => false,
  93. }
  94. }
  95. }
  96. # check if the wc already exists
  97. $found = oracle_exists( $wcOracleHome )
  98. if $found == undef {
  99. $continue = true
  100. } else {
  101. if ( $found ) {
  102. $continue = false
  103. } else {
  104. notify {"wls::installwc ${title} ${$wcOracleHome} does not exists":}
  105. $continue = true
  106. }
  107. }
  108. if ( $continue ) {
  109. if $puppetDownloadMntPoint == undef {
  110. $mountPoint = "puppet:///modules/wls/"
  111. } else {
  112. $mountPoint = $puppetDownloadMntPoint
  113. }
  114. wls::utils::orainst{'create wc oraInst':
  115. oraInventory => $oraInventory,
  116. group => $group,
  117. }
  118. $wcTemplate = "wls/silent_wc.xml.erb"
  119. # if ! defined(File["${path}/${title}silent_wc.xml"]) {
  120. file { "${path}/${title}silent_wc.xml":
  121. ensure => present,
  122. content => template($wcTemplate),
  123. require => Wls::Utils::Orainst ['create wc oraInst'],
  124. }
  125. # }
  126. # weblogic generic installer zip
  127. if $remoteFile == true {
  128. file { "${path}/${wcFile}":
  129. source => "${mountPoint}/${wcFile}",
  130. require => File ["${path}/${title}silent_wc.xml"],
  131. }
  132. }
  133. $command = "-silent -response ${path}/${title}silent_wc.xml -waitforcompletion "
  134. case $operatingsystem {
  135. CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES: {
  136. if $remoteFile == true {
  137. exec { "extract ${wcFile}":
  138. command => "unzip ${path}/${wcFile} -d ${path}/wc",
  139. require => [File ["${path}/${wcFile}"],File ["${path}/${title}silent_wc.xml"]],
  140. creates => "${path}/wc",
  141. }
  142. } else {
  143. exec { "extract ${wcFile}":
  144. command => "unzip ${mountPoint}/${wcFile} -d ${path}/wc",
  145. require => File ["${path}/${title}silent_wc.xml"],
  146. creates => "${path}/wc",
  147. }
  148. }
  149. exec { "install wc ${title}":
  150. command => "${path}/wc/Disk1/install/${wcInstallDir}/runInstaller ${command} -invPtrLoc /etc/oraInst.loc -ignoreSysPrereqs -jreLoc ${jreLocDir}",
  151. require => [File ["${path}/${title}silent_wc.xml"],Exec["extract ${wcFile}"]],
  152. creates => $wcOracleHome,
  153. timeout => 0,
  154. }
  155. }
  156. Solaris: {
  157. if $remoteFile == true {
  158. exec { "extract ${wcFile}":
  159. command => "unzip ${path}/${wcFile} -d ${path}/wc",
  160. require => [File ["${path}/${wcFile}"],File ["${path}/${title}silent_wc.xml"]],
  161. creates => "${path}/wc",
  162. }
  163. } else {
  164. exec { "extract ${wcFile}":
  165. command => "unzip ${mountPoint}/${wcFile} -d ${path}/wc",
  166. require => File ["${path}/${title}silent_wc.xml"],
  167. creates => "${path}/wc",
  168. }
  169. }
  170. exec { "add -d64 oraparam.ini wc":
  171. 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",
  172. require => Exec["extract ${wcFile}"],
  173. }
  174. exec { "install wc ${title}":
  175. command => "${path}/wc/Disk1/install/${wcInstallDir}/runInstaller ${command} -invPtrLoc /var/opt/oraInst.loc -ignoreSysPrereqs -jreLoc ${jreLocDir}",
  176. require => [File ["${path}/${title}silent_wc.xml"],Exec["extract ${wcFile}"],Exec["add -d64 oraparam.ini wc"]],
  177. creates => $wcOracleHome,
  178. timeout => 0,
  179. }
  180. }
  181. windows: {
  182. if $remoteFile == true {
  183. exec { "extract ${wcFile}":
  184. command => "${checkCommand} unzip ${path}/${wcFile} -d ${path}/wc",
  185. require => File ["${path}/${wcFile}"],
  186. creates => "${path}/wc/Disk1",
  187. cwd => $path,
  188. }
  189. } else {
  190. exec { "extract ${wcFile}":
  191. command => "${checkCommand} unzip ${mountPoint}/${wcFile} -d ${path}/wc",
  192. creates => "${path}/wc/Disk1",
  193. cwd => $path,
  194. }
  195. }
  196. exec {"icacls wc disk ${title}":
  197. command => "${checkCommand} icacls ${path}\\wc\\* /T /C /grant Administrator:F Administrators:F",
  198. logoutput => false,
  199. require => Exec["extract ${wcFile}"],
  200. }
  201. exec { "install wc ${title}":
  202. command => "${path}\\wc\\Disk1\\setup.exe ${command} -ignoreSysPrereqs -jreLoc C:\\oracle\\${fullJDKName}",
  203. logoutput => true,
  204. require => [Exec["icacls wc disk ${title}"],File ["${path}/${title}silent_wc.xml"],Exec["extract ${wcFile}"]],
  205. creates => $wcOracleHome,
  206. timeout => 0,
  207. }
  208. }
  209. }
  210. }
  211. }