installadf.pp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  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. backup => false,
  88. }
  89. }
  90. Solaris: {
  91. $execPath = "/usr/jdk/${fullJDKName}/bin/amd64:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:"
  92. $path = $downloadDir
  93. $oraInventory = "${oracleHome}/oraInventory"
  94. $adfInstallDir = "intelsolaris"
  95. $jreLocDir = "/usr/jdk/${fullJDKName}"
  96. Exec { path => $execPath,
  97. user => $user,
  98. group => $group,
  99. logoutput => true,
  100. }
  101. File {
  102. ensure => present,
  103. mode => 0775,
  104. owner => $user,
  105. group => $group,
  106. backup => false,
  107. }
  108. }
  109. windows: {
  110. $execPath = "C:\\oracle\\${fullJDKName}\\bin;C:\\unxutils\\bin;C:\\unxutils\\usr\\local\\wbin;C:\\Windows\\system32;C:\\Windows"
  111. $checkCommand = "C:\\Windows\\System32\\cmd.exe /c"
  112. $path = $downloadDir
  113. $oraInventory = "C:\\Program Files\\Oracle\\Inventory"
  114. Exec { path => $execPath,
  115. }
  116. File { ensure => present,
  117. mode => 0555,
  118. backup => false,
  119. }
  120. }
  121. }
  122. # 12.1.2 is a full install , 11g is a add-on
  123. if $adfFile == 'fmw_infra_121200.jar' {
  124. $version = "1212"
  125. $adfTemplate = "wls/silent_1212_adf.xml.erb"
  126. if ( $continue ) {
  127. wls::utils::defaultusersfolders{'create adf home':
  128. oracleHome => $commonOracleHome,
  129. oraInventory => $oraInventory,
  130. createUser => $createUser,
  131. user => $user,
  132. group => $group,
  133. downloadDir => $path,
  134. }
  135. }
  136. } else {
  137. $version = "1111"
  138. $adfTemplate = "wls/silent_adf.xml.erb"
  139. }
  140. if ( $continue ) {
  141. if $puppetDownloadMntPoint == undef {
  142. $mountPoint = "puppet:///modules/wls/"
  143. } else {
  144. $mountPoint = $puppetDownloadMntPoint
  145. }
  146. wls::utils::orainst{'create adf oraInst':
  147. oraInventory => $oraInventory,
  148. group => $group,
  149. }
  150. # adf generic installer zip
  151. if ! defined(File["${path}/${adfFile}"]) {
  152. file { "${path}/${adfFile}":
  153. source => "${mountPoint}/${adfFile}",
  154. require => Wls::Utils::Orainst ['create adf oraInst'],
  155. }
  156. }
  157. $command = "-silent -response ${path}/${title}silent_adf.xml -waitforcompletion "
  158. case $operatingsystem {
  159. CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES: {
  160. if ($version != "1212" ) {
  161. if ! defined(Exec["extract ${adfFile}"]) {
  162. exec { "extract ${adfFile}":
  163. command => "unzip ${path}/${adfFile} -d ${path}/adf",
  164. require => File ["${path}/${adfFile}"],
  165. creates => "${path}/adf",
  166. }
  167. }
  168. }
  169. file { "${path}/${title}silent_adf.xml":
  170. ensure => present,
  171. content => template($adfTemplate),
  172. }
  173. if ($version == "1212" ) {
  174. exec { "install adf ${title}":
  175. command => "java -jar ${path}/${adfFile} ${command} -invPtrLoc /etc/oraInst.loc -ignoreSysPrereqs",
  176. require => [Wls::Utils::Defaultusersfolders['create adf home'],File ["${path}/${title}silent_adf.xml"],File["${path}/${adfFile}"]],
  177. timeout => 0,
  178. }
  179. } else {
  180. file { "${path}/${title}silent_adf.xml":
  181. ensure => present,
  182. content => template($adfTemplate),
  183. }
  184. exec { "install adf ${title}":
  185. command => "${path}/adf/Disk1/install/${adfInstallDir}/runInstaller ${command} -invPtrLoc /etc/oraInst.loc -ignoreSysPrereqs -jreLoc ${jreLocDir}",
  186. require => [File ["${path}/${title}silent_adf.xml"],Exec["extract ${adfFile}"]],
  187. creates => $commonOracleHome,
  188. }
  189. }
  190. }
  191. Solaris: {
  192. if ($version != "1212" ) {
  193. if ! defined(Exec["extract ${adfFile}"]) {
  194. exec { "extract ${adfFile}":
  195. command => "unzip ${path}/${adfFile} -d ${path}/adf",
  196. require => File ["${path}/${adfFile}"],
  197. creates => "${path}/adf",
  198. }
  199. }
  200. }
  201. if ($version == "1212" ) {
  202. exec { "install adf ${title}":
  203. command => "java -jar ${path}/${adfFile} ${command} -invPtrLoc /var/opt/oraInst.loc -ignoreSysPrereqs",
  204. require => [Wls::Utils::Defaultusersfolders['create adf home'],File ["${path}/${title}silent_adf.xml"],File["${path}/${adfFile}"]],
  205. timeout => 0,
  206. }
  207. } else {
  208. exec { "add -d64 oraparam.ini osb":
  209. 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",
  210. # 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",
  211. require => Exec["extract ${adfFile}"],
  212. }
  213. exec { "install adf ${title}":
  214. command => "${path}/adf/Disk1/install/${adfInstallDir}/runInstaller ${command} -invPtrLoc /var/opt/oraInst.loc -ignoreSysPrereqs -jreLoc ${jreLocDir}",
  215. require => [File ["${path}/${title}silent_adf.xml"],Exec["extract ${adfFile}"],Exec["add -d64 oraparam.ini osb"]],
  216. creates => $commonOracleHome,
  217. }
  218. # fix opatch bug with d64 param on jdk x64
  219. exec { "chmod ${commonOracleHome}/OPatch/opatch first":
  220. command => "chmod 775 ${commonOracleHome}/OPatch/opatch",
  221. require => Exec ["install adf ${title}"], }
  222. exec { "add quotes for d64 param in ${commonOracleHome}/OPatch/opatch":
  223. 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",
  224. require => Exec ["chmod ${commonOracleHome}/OPatch/opatch first"],
  225. }
  226. exec { "chmod ${commonOracleHome}/OPatch/opatch after":
  227. command => "chmod 775 ${commonOracleHome}/OPatch/opatch",
  228. require => Exec ["add quotes for d64 param in ${commonOracleHome}/OPatch/opatch"],
  229. }
  230. }
  231. }
  232. windows: {
  233. if ($version == "1212" ) {
  234. exec {"icacls adf disk ${title}":
  235. command => "${checkCommand} icacls ${path}\\${adfFile} /T /C /grant Administrator:F Administrators:F",
  236. logoutput => false,
  237. require => Exec["extract ${adfFile}"],
  238. }
  239. exec { "install adf ${title}":
  240. command => "${checkCommand} java -jar ${path}/${adfFile} ${command} -ignoreSysPrereqs",
  241. require => [Exec["icacls adf disk ${title}"],File ["${path}/${title}silent_adf.xml"],File["${path}/${adfFile}"]],
  242. timeout => 0,
  243. }
  244. } else {
  245. if ! defined(Exec["extract ${adfFile}"]) {
  246. exec { "extract ${adfFile}":
  247. command => "${checkCommand} unzip ${path}/${adfFile} -d ${path}/adf",
  248. require => File ["${path}/${adfFile}"],
  249. creates => "${path}/adf/Disk1",
  250. cwd => $path,
  251. }
  252. }
  253. exec {"icacls adf disk ${title}":
  254. command => "${checkCommand} icacls ${path}\\adf\\* /T /C /grant Administrator:F Administrators:F",
  255. logoutput => false,
  256. require => Exec["extract ${adfFile}"],
  257. }
  258. exec { "install adf ${title}":
  259. command => "${path}\\adf\\Disk1\\setup.exe ${command} -ignoreSysPrereqs -jreLoc C:\\oracle\\${fullJDKName}",
  260. logoutput => true,
  261. require => [Wls::Utils::Defaultusersfolders['create adf home'],Exec["icacls adf disk ${title}"],File ["${path}/${title}silent_adf.xml"],Exec["extract ${adfFile}"]],
  262. creates => $commonOracleHome,
  263. }
  264. }
  265. }
  266. }
  267. }
  268. }