installadf.pp 11 KB

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