installwcc.pp 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. # == Define: wls::installwcc
  2. #
  3. # installs Oracle Webcenter content addon
  4. #
  5. # === Examples
  6. #
  7. # $jdkWls11gJDK = 'jdk1.7.0_09'
  8. # $wls11gVersion = "1036"
  9. #
  10. # case $operatingsystem {
  11. # CentOS, RedHat, OracleLinux, Ubuntu, Debian: {
  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/wls11g"
  20. # $osWlHome = "c:/oracle/wls11g/wlserver_10.3"
  21. # $user = "Administrator"
  22. # $group = "Administrators"
  23. # }
  24. # }
  25. #
  26. #
  27. # Wls::Installwcc {
  28. # mdwHome => $osMdwHome,
  29. # wlHome => $osWlHome,
  30. # fullJDKName => $jdkWls11gJDK,
  31. # user => $user,
  32. # group => $group,
  33. # }
  34. #
  35. #
  36. # wls::installwcc{'wccPS6':
  37. # wccFile1 => 'ofm_wcc_generic_11.1.1.7.0_disk1_1of2.zip',
  38. # wccFile2 => 'ofm_wcc_generic_11.1.1.6.0_disk1_2of2.zip',
  39. # }
  40. #
  41. ##
  42. define wls::installwcc($mdwHome = undef,
  43. $wlHome = undef,
  44. $oracleHome = undef,
  45. $fullJDKName = undef,
  46. $wccFile1 = undef,
  47. $wccFile2 = undef,
  48. $user = 'oracle',
  49. $group = 'dba',
  50. $downloadDir = '/install',
  51. $remoteFile = true,
  52. $puppetDownloadMntPoint = undef,
  53. ) {
  54. case $operatingsystem {
  55. CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES: {
  56. $execPath = "/usr/java/${fullJDKName}/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:"
  57. $path = $downloadDir
  58. $wccOracleHome = "${mdwHome}/Oracle_WCC1"
  59. $oraInventory = "${oracleHome}/oraInventory"
  60. $wccInstallDir = "linux64"
  61. $jreLocDir = "/usr/java/${fullJDKName}"
  62. Exec { path => $execPath,
  63. user => $user,
  64. group => $group,
  65. logoutput => true,
  66. }
  67. File {
  68. ensure => present,
  69. mode => 0775,
  70. owner => $user,
  71. group => $group,
  72. backup => false,
  73. }
  74. }
  75. Solaris: {
  76. $execPath = "/usr/jdk/${fullJDKName}/bin/amd64:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:"
  77. $path = $downloadDir
  78. $wccOracleHome = "${mdwHome}/Oracle_WCC1"
  79. $oraInventory = "${oracleHome}/oraInventory"
  80. $wccInstallDir = "intelsolaris"
  81. $jreLocDir = "/usr/jdk/${fullJDKName}"
  82. Exec { path => $execPath,
  83. user => $user,
  84. group => $group,
  85. logoutput => true,
  86. }
  87. File {
  88. ensure => present,
  89. mode => 0775,
  90. owner => $user,
  91. group => $group,
  92. backup => false,
  93. }
  94. }
  95. windows: {
  96. $execPath = "C:\\oracle\\${fullJDKName}\\bin;C:\\unxutils\\bin;C:\\unxutils\\usr\\local\\wbin;C:\\Windows\\system32;C:\\Windows"
  97. $checkCommand = "C:\\Windows\\System32\\cmd.exe /c"
  98. $path = $downloadDir
  99. $wccOracleHome = "${mdwHome}/Oracle_WCC1"
  100. Exec { path => $execPath,
  101. }
  102. File { ensure => present,
  103. mode => 0777,
  104. backup => false,
  105. }
  106. }
  107. }
  108. # check if the wcc already exists
  109. $found = oracle_exists( $wccOracleHome )
  110. if $found == undef {
  111. $continue = true
  112. } else {
  113. if ( $found ) {
  114. $continue = false
  115. } else {
  116. notify {"wls::installwcc ${title} ${wccOracleHome} does not exists":}
  117. $continue = true
  118. }
  119. }
  120. if ( $continue ) {
  121. if $puppetDownloadMntPoint == undef {
  122. $mountPoint = "puppet:///modules/wls/"
  123. } else {
  124. $mountPoint = $puppetDownloadMntPoint
  125. }
  126. wls::utils::orainst{'create wcc oraInst':
  127. oraInventory => $oraInventory,
  128. group => $group,
  129. }
  130. $wccTemplate = "wls/silent_wcc.xml.erb"
  131. # if ! defined(File["${path}/${title}silent_wcc.xml"]) {
  132. file { "${path}/${title}silent_wcc.xml":
  133. ensure => present,
  134. content => template($wccTemplate),
  135. require => Wls::Utils::Orainst ['create wcc oraInst'],
  136. }
  137. # }
  138. # wcc file 1 installer zip
  139. if $remoteFile == true {
  140. file { "${path}/${wccFile1}":
  141. source => "${mountPoint}/${wccFile1}",
  142. require => File ["${path}/${title}silent_wcc.xml"],
  143. }
  144. file { "${path}/${wccFile2}":
  145. source => "${mountPoint}/${wccFile2}",
  146. require => [File ["${path}/${title}silent_wcc.xml"],File["${path}/${wccFile1}"]],
  147. }
  148. }
  149. $command = "-silent -response ${path}/${title}silent_wcc.xml -waitforcompletion "
  150. case $operatingsystem {
  151. CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES: {
  152. if $remoteFile == true {
  153. exec { "extract ${wccFile1}":
  154. command => "unzip -o ${path}/${wccFile1} -d ${path}/wcc",
  155. creates => "${path}/wcc/Disk1",
  156. require => [File ["${path}/${wccFile2}"],File ["${path}/${wccFile1}"]],
  157. }
  158. exec { "extract ${wccFile2}":
  159. command => "unzip -o ${path}/${wccFile2} -d ${path}/wcc",
  160. creates => "${path}/wcc/Disk2",
  161. require => [File ["${path}/${wccFile2}"],Exec["extract ${wccFile1}"]],
  162. }
  163. } else {
  164. exec { "extract ${wccFile1}":
  165. command => "unzip -o ${mountPoint}/${wccFile1} -d ${path}/wcc",
  166. creates => "${path}/wcc/Disk1",
  167. }
  168. exec { "extract ${wccFile2}":
  169. command => "unzip -o ${mountPoint}/${wccFile2} -d ${path}/wcc",
  170. creates => "${path}/wcc/Disk2",
  171. require => Exec["extract ${wccFile1}"],
  172. }
  173. }
  174. exec { "install wcc ${title}":
  175. command => "${path}/wcc/Disk1/install/${wccInstallDir}/runInstaller ${command} -invPtrLoc /etc/oraInst.loc -ignoreSysPrereqs -jreLoc ${jreLocDir}",
  176. require => [File["${path}/${title}silent_wcc.xml"],Exec["extract ${wccFile1}"],Exec["extract ${wccFile2}"]],
  177. creates => $wccOracleHome,
  178. timeout => 0,
  179. }
  180. }
  181. Solaris: {
  182. if $remoteFile == true {
  183. exec { "extract ${wccFile1}":
  184. command => "unzip ${path}/${wccFile1} -d ${path}/wcc",
  185. creates => "${path}/wcc/Disk1",
  186. require => [File ["${path}/${wccFile2}"],File ["${path}/${wccFile1}"]],
  187. }
  188. exec { "extract ${wccFile2}":
  189. command => "unzip -o ${path}/${wccFile2} -d ${path}/wcc",
  190. creates => "${path}/wcc/Disk2",
  191. require => [File ["${path}/${wccFile2}"],Exec["extract ${wccFile1}"]],
  192. }
  193. } else {
  194. exec { "extract ${wccFile1}":
  195. command => "unzip ${mountPoint}/${wccFile1} -d ${path}/wcc",
  196. creates => "${path}/wcc/Disk1",
  197. }
  198. exec { "extract ${wccFile2}":
  199. command => "unzip -o ${mountPoint}/${wccFile2} -d ${path}/wcc",
  200. creates => "${path}/wcc/Disk2",
  201. require => Exec["extract ${wccFile1}"],
  202. }
  203. }
  204. exec { "add -d64 oraparam.ini wcc":
  205. command => "sed -e's/JRE_MEMORY_OPTIONS=\" -Xverify:none\"/JRE_MEMORY_OPTIONS=\"-d64 -Xverify:none\"/g' ${path}/wcc/Disk1/install/${wccInstallDir}/oraparam.ini > /tmp/wcc.tmp && mv /tmp/wcc.tmp ${path}/wcc/Disk1/install/${wccInstallDir}/oraparam.ini",
  206. require => [Exec["extract ${wccFile1}"],Exec["extract ${wccFile2}"]],
  207. }
  208. exec { "install wcc ${title}":
  209. command => "${path}/wcc/Disk1/install/${wccInstallDir}/runInstaller ${command} -invPtrLoc /var/opt/oraInst.loc -ignoreSysPrereqs -jreLoc ${jreLocDir}",
  210. require => [File["${path}/${title}silent_wcc.xml"],Exec["extract ${wccFile1}"],Exec["extract ${wccFile2}"],Exec["add -d64 oraparam.ini wcc"]],
  211. creates => $wccOracleHome,
  212. timeout => 0,
  213. }
  214. }
  215. windows: {
  216. if $remoteFile == true {
  217. exec { "extract ${wccFile1}":
  218. command => "${checkCommand} unzip ${path}/${wccFile1} -d ${path}/wcc",
  219. require => [Registry_Value ["HKEY_LOCAL_MACHINE\\SOFTWARE\\Oracle\\inst_loc"],File ["${path}/${wccFile1}"]],
  220. creates => "${path}/wcc/Disk1",
  221. }
  222. exec { "extract ${wccFile2}":
  223. command => "${checkCommand} unzip -o ${path}/${wccFile2} -d ${path}/wcc",
  224. require => [Exec["extract ${wccFile1}"],File ["${path}/${wccFile2}"]],
  225. creates => "${path}/wcc/Disk2",
  226. }
  227. } else {
  228. exec { "extract ${wccFile1}":
  229. command => "${checkCommand} unzip ${mountPoint}/${wccFile1} -d ${path}/wcc",
  230. require => Registry_Value ["HKEY_LOCAL_MACHINE\\SOFTWARE\\Oracle\\inst_loc"],
  231. creates => "${path}/wcc/Disk1",
  232. }
  233. exec { "extract ${wccFile2}":
  234. command => "${checkCommand} unzip -o ${mountPoint}/${wccFile2} -d ${path}/wcc",
  235. require => Exec["extract ${wccFile1}"],
  236. creates => "${path}/wcc/Disk2",
  237. }
  238. }
  239. exec {"icacls wcc disk ${title}":
  240. command => "${checkCommand} icacls ${path}\\wcc\\* /T /C /grant Administrator:F Administrators:F",
  241. logoutput => false,
  242. require => [Exec["extract ${wccFile2}"],Exec["extract ${wccFile1}"]],
  243. }
  244. exec { "install wcc ${title}":
  245. command => "${path}\\wcc\\Disk1\\setup.exe ${command} -ignoreSysPrereqs -jreLoc C:\\oracle\\${fullJDKName}",
  246. logoutput => true,
  247. require => [Exec["icacls wcc disk ${title}"],File["${path}/${title}silent_wcc.xml"],Exec["extract ${wccFile2}"],Exec["extract ${wccFile1}"]],
  248. creates => $wccOracleHome,
  249. timeout => 0,
  250. }
  251. }
  252. }
  253. }
  254. }