installsoa.pp 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. # == Define: wls::installsoa
  2. #
  3. # installs Oracle SOA Suite 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::Installsoa {
  28. # mdwHome => $osMdwHome,
  29. # wlHome => $osWlHome,
  30. # fullJDKName => $jdkWls11gJDK,
  31. # user => $user,
  32. # group => $group,
  33. # }
  34. #
  35. #
  36. # wls::installsoa{'soaPS5':
  37. # soaFile1 => 'ofm_soa_generic_11.1.1.6.0_disk1_1of2.zip',
  38. # soaFile2 => 'ofm_soa_generic_11.1.1.6.0_disk1_2of2.zip',
  39. # }
  40. #
  41. ##
  42. define wls::installsoa($mdwHome = undef,
  43. $wlHome = undef,
  44. $oracleHome = undef,
  45. $fullJDKName = undef,
  46. $soaFile1 = undef,
  47. $soaFile2 = 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. $soaOracleHome = "${mdwHome}/Oracle_SOA1"
  59. $oraInventory = "${oracleHome}/oraInventory"
  60. $soaInstallDir = "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. $soaOracleHome = "${mdwHome}/Oracle_SOA1"
  79. $oraInventory = "${oracleHome}/oraInventory"
  80. $soaInstallDir = "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. $soaOracleHome = "${mdwHome}/Oracle_SOA1"
  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( $soaOracleHome )
  110. if $found == undef {
  111. $continue = true
  112. } else {
  113. if ( $found ) {
  114. $continue = false
  115. } else {
  116. notify {"wls::installsoa ${title} ${soaOracleHome} 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 soa oraInst':
  127. oraInventory => $oraInventory,
  128. group => $group,
  129. }
  130. $soaTemplate = "wls/silent_soa.xml.erb"
  131. # if ! defined(File["${path}/${title}silent_soa.xml"]) {
  132. file { "${path}/${title}silent_soa.xml":
  133. ensure => present,
  134. content => template($soaTemplate),
  135. require => Wls::Utils::Orainst ['create soa oraInst'],
  136. }
  137. # }
  138. # for performance reasons, download and install or just install it
  139. if $remoteFile == true {
  140. # soa file 1 installer zip
  141. if ! defined(File["${path}/${soaFile1}"]) {
  142. file { "${path}/${soaFile1}":
  143. source => "${mountPoint}/${soaFile1}",
  144. require => File ["${path}/${title}silent_soa.xml"],
  145. }
  146. }
  147. # soa file 2 installer zip
  148. if ! defined(File["${path}/${soaFile2}"]) {
  149. file { "${path}/${soaFile2}":
  150. source => "${mountPoint}/${soaFile2}",
  151. require => [File ["${path}/${title}silent_soa.xml"],File["${path}/${soaFile1}"]],
  152. }
  153. }
  154. }
  155. $command = "-silent -response ${path}/${title}silent_soa.xml -waitforcompletion "
  156. case $operatingsystem {
  157. CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES: {
  158. # for performance reasons, download and install or just install it
  159. if $remoteFile == true {
  160. exec { "extract ${soaFile1}":
  161. command => "unzip -o ${path}/${soaFile1} -d ${path}/soa",
  162. creates => "${path}/soa/Disk1",
  163. require => [File ["${path}/${soaFile2}"],File ["${path}/${soaFile1}"]],
  164. }
  165. exec { "extract ${soaFile2}":
  166. command => "unzip -o ${path}/${soaFile2} -d ${path}/soa",
  167. creates => "${path}/soa/Disk5",
  168. require => [File ["${path}/${soaFile2}"],Exec["extract ${soaFile1}"]],
  169. }
  170. } else {
  171. exec { "extract ${soaFile1}":
  172. command => "unzip -o ${puppetDownloadMntPoint}/${soaFile1} -d ${path}/soa",
  173. creates => "${path}/soa/Disk1",
  174. }
  175. exec { "extract ${soaFile2}":
  176. command => "unzip -o ${puppetDownloadMntPoint}/${soaFile2} -d ${path}/soa",
  177. creates => "${path}/soa/Disk5",
  178. require => Exec["extract ${soaFile1}"],
  179. }
  180. }
  181. exec { "install soa ${title}":
  182. command => "${path}/soa/Disk1/install/${soaInstallDir}/runInstaller ${command} -invPtrLoc /etc/oraInst.loc -ignoreSysPrereqs -jreLoc ${jreLocDir}",
  183. require => [File["${path}/${title}silent_soa.xml"],Exec["extract ${soaFile1}"],Exec["extract ${soaFile2}"]],
  184. creates => $soaOracleHome,
  185. timeout => 0,
  186. }
  187. }
  188. Solaris: {
  189. if $remoteFile == true {
  190. exec { "extract ${soaFile1}":
  191. command => "unzip ${path}/${soaFile1} -d ${path}/soa",
  192. creates => "${path}/soa/Disk1",
  193. require => [File ["${path}/${soaFile2}"],File ["${path}/${soaFile1}"]],
  194. }
  195. exec { "extract ${soaFile2}":
  196. command => "unzip ${path}/${soaFile2} -d ${path}/soa",
  197. creates => "${path}/soa/Disk5",
  198. require => [File ["${path}/${soaFile2}"],Exec["extract ${soaFile1}"]],
  199. }
  200. } else {
  201. exec { "extract ${soaFile1}":
  202. command => "unzip ${puppetDownloadMntPoint}/${soaFile1} -d ${path}/soa",
  203. creates => "${path}/soa/Disk1",
  204. }
  205. exec { "extract ${soaFile2}":
  206. command => "unzip ${puppetDownloadMntPoint}/${soaFile2} -d ${path}/soa",
  207. creates => "${path}/soa/Disk5",
  208. require => Exec["extract ${soaFile1}"],
  209. }
  210. }
  211. exec { "add -d64 oraparam.ini soa":
  212. command => "sed -e's/JRE_MEMORY_OPTIONS=\" -Xverify:none\"/JRE_MEMORY_OPTIONS=\"-d64 -Xverify:none\"/g' ${path}/soa/Disk1/install/${soaInstallDir}/oraparam.ini > /tmp/soa.tmp && mv /tmp/soa.tmp ${path}/soa/Disk1/install/${soaInstallDir}/oraparam.ini",
  213. require => [Exec["extract ${soaFile1}"],Exec["extract ${soaFile2}"]],
  214. }
  215. exec { "install soa ${title}":
  216. command => "${path}/soa/Disk1/install/${soaInstallDir}/runInstaller ${command} -invPtrLoc /var/opt/oraInst.loc -ignoreSysPrereqs -jreLoc ${jreLocDir}",
  217. require => [File["${path}/${title}silent_soa.xml"],Exec["extract ${soaFile1}"],Exec["extract ${soaFile2}"],Exec["add -d64 oraparam.ini soa"]],
  218. creates => $soaOracleHome,
  219. timeout => 0,
  220. }
  221. }
  222. windows: {
  223. if $remoteFile == true {
  224. exec { "extract ${soaFile1}":
  225. command => "${checkCommand} unzip ${path}/${soaFile1} -d ${path}/soa",
  226. require => [Registry_Value ["HKEY_LOCAL_MACHINE\\SOFTWARE\\Oracle\\inst_loc"],File ["${path}/${soaFile1}"]],
  227. creates => "${path}/soa/Disk1",
  228. }
  229. exec { "extract ${soaFile2}":
  230. command => "${checkCommand} unzip ${path}/${soaFile2} -d ${path}/soa",
  231. require => [Exec["extract ${soaFile1}"],File ["${path}/${soaFile2}"]],
  232. creates => "${path}/soa/Disk5",
  233. }
  234. } else {
  235. exec { "extract ${soaFile1}":
  236. command => "${checkCommand} unzip ${puppetDownloadMntPoint}/${soaFile1} -d ${path}/soa",
  237. require => Registry_Value ["HKEY_LOCAL_MACHINE\\SOFTWARE\\Oracle\\inst_loc"],
  238. creates => "${path}/soa/Disk1",
  239. }
  240. exec { "extract ${soaFile2}":
  241. command => "${checkCommand} unzip ${puppetDownloadMntPoint}/${soaFile2} -d ${path}/soa",
  242. require => Exec["extract ${soaFile1}"],
  243. creates => "${path}/soa/Disk5",
  244. }
  245. }
  246. exec {"icacls soa disk ${title}":
  247. command => "${checkCommand} icacls ${path}\\soa\\* /T /C /grant Administrator:F Administrators:F",
  248. logoutput => false,
  249. require => [Exec["extract ${soaFile2}"],Exec["extract ${soaFile1}"]],
  250. }
  251. exec { "install soa ${title}":
  252. command => "${path}\\soa\\Disk1\\setup.exe ${command} -ignoreSysPrereqs -jreLoc C:\\oracle\\${fullJDKName}",
  253. logoutput => true,
  254. require => [Exec["icacls soa disk ${title}"],File["${path}/${title}silent_soa.xml"],Exec["extract ${soaFile2}"],Exec["extract ${soaFile1}"]],
  255. creates => $soaOracleHome,
  256. timeout => 0,
  257. }
  258. }
  259. }
  260. }
  261. }