installoim.pp 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. # == Define: wls::installoim
  2. #
  3. # installs Oracle Identity Management addon
  4. #
  5. # === Examples
  6. #
  7. # $jdkWls11gJDK = 'jdk1.7.0_40'
  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::Installoim {
  28. # mdwHome => $osMdwHome,
  29. # wlHome => $osWlHome,
  30. # fullJDKName => $jdkWls11gJDK,
  31. # user => $user,
  32. # group => $group,
  33. # }
  34. #
  35. #
  36. # wls::installoim{'oim11.2':
  37. # oimFile1 => 'V37472-01_1of2.zip',
  38. # oimFile2 => 'V37472-01_2of2.zip',
  39. # }
  40. #
  41. #
  42. define wls::installoim($mdwHome = undef,
  43. $wlHome = undef,
  44. $oracleHome = undef,
  45. $fullJDKName = undef,
  46. $oimFile1 = undef,
  47. $oimFile2 = undef,
  48. $user = 'oracle',
  49. $group = 'dba',
  50. $downloadDir = '/install',
  51. $puppetDownloadMntPoint = undef,
  52. $remoteFile = true,
  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. $oimOracleHome = "${mdwHome}/Oracle_IDM1"
  59. $oraInventory = "${oracleHome}/oraInventory"
  60. $oimInstallDir = "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. $oimOracleHome = "${mdwHome}/Oracle_IDM1"
  79. $oraInventory = "${oracleHome}/oraInventory"
  80. $oimInstallDir = "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. $oimOracleHome = "${mdwHome}/Oracle_IDM1"
  100. Exec { path => $execPath,
  101. }
  102. File { ensure => present,
  103. mode => 0777,
  104. backup => false,
  105. }
  106. }
  107. }
  108. # check if the oim already exists
  109. $found = oracle_exists( $oimOracleHome )
  110. if $found == undef {
  111. $continue = true
  112. } else {
  113. if ( $found ) {
  114. $continue = false
  115. } else {
  116. notify {"wls::installoim ${title} ${oimOracleHome} 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 oim oraInst':
  127. oraInventory => $oraInventory,
  128. group => $group,
  129. }
  130. $oimTemplate = "wls/silent_oim.xml.erb"
  131. file { "${path}/${title}silent_oim.xml":
  132. ensure => present,
  133. content => template($oimTemplate),
  134. require => Wls::Utils::Orainst ['create oim oraInst'],
  135. }
  136. if $remoteFile == true {
  137. # oim file 1 installer zip
  138. file { "${path}/${oimFile1}":
  139. source => "${mountPoint}/${oimFile1}",
  140. require => File ["${path}/${title}silent_oim.xml"],
  141. }
  142. # oim file 2 installer zip
  143. file { "${path}/${oimFile2}":
  144. source => "${mountPoint}/${oimFile2}",
  145. require => [File ["${path}/${title}silent_oim.xml"],File["${path}/${oimFile1}"]],
  146. }
  147. }
  148. $command = "-silent -response ${path}/${title}silent_oim.xml -waitforcompletion "
  149. case $operatingsystem {
  150. CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES: {
  151. if $remoteFile == true {
  152. exec { "extract ${oimFile1}":
  153. command => "unzip -o ${path}/${oimFile1} -d ${path}/oim",
  154. creates => "${path}/oim/Disk1",
  155. require => [File ["${path}/${oimFile2}"],File ["${path}/${oimFile1}"]],
  156. }
  157. exec { "extract ${oimFile2}":
  158. command => "unzip -o ${path}/${oimFile2} -d ${path}/oim",
  159. creates => "${path}/oim/Disk3",
  160. require => [File ["${path}/${oimFile2}"],Exec["extract ${oimFile1}"]],
  161. }
  162. } else {
  163. exec { "extract ${oimFile1}":
  164. command => "unzip -o ${puppetDownloadMntPoint}/${oimFile1} -d ${path}/oim",
  165. creates => "${path}/oim/Disk1",
  166. }
  167. exec { "extract ${oimFile2}":
  168. command => "unzip -o ${puppetDownloadMntPoint}/${oimFile2} -d ${path}/oim",
  169. creates => "${path}/oim/Disk3",
  170. require => Exec["extract ${oimFile1}"],
  171. }
  172. }
  173. exec { "install oim ${title}":
  174. command => "${path}/oim/Disk1/install/${oimInstallDir}/runInstaller ${command} -invPtrLoc /etc/oraInst.loc -ignoreSysPrereqs -jreLoc ${jreLocDir}",
  175. require => [File["${path}/${title}silent_oim.xml"],Exec["extract ${oimFile1}"],Exec["extract ${oimFile2}"]],
  176. creates => $oimOracleHome,
  177. timeout => 0,
  178. }
  179. }
  180. Solaris: {
  181. if $remoteFile == true {
  182. exec { "extract ${oimFile1}":
  183. command => "unzip ${path}/${oimFile1} -d ${path}/oim",
  184. creates => "${path}/oim/Disk1",
  185. require => [File ["${path}/${oimFile2}"],File ["${path}/${oimFile1}"]],
  186. }
  187. exec { "extract ${oimFile2}":
  188. command => "unzip ${path}/${oimFile2} -d ${path}/oim",
  189. creates => "${path}/oim/Disk3",
  190. require => [File ["${path}/${oimFile2}"],Exec["extract ${oimFile1}"]],
  191. }
  192. } else {
  193. exec { "extract ${oimFile1}":
  194. command => "unzip ${puppetDownloadMntPoint}/${oimFile1} -d ${path}/oim",
  195. creates => "${path}/oim/Disk1",
  196. }
  197. exec { "extract ${oimFile2}":
  198. command => "unzip ${puppetDownloadMntPoint}/${oimFile2} -d ${path}/oim",
  199. creates => "${path}/oim/Disk3",
  200. require => Exec["extract ${oimFile1}"],
  201. }
  202. }
  203. exec { "add -d64 oraparam.ini oim":
  204. command => "sed -e's/JRE_MEMORY_OPTIONS=\" -Xverify:none\"/JRE_MEMORY_OPTIONS=\"-d64 -Xverify:none\"/g' ${path}/oim/Disk1/install/${oimInstallDir}/oraparam.ini > /tmp/oim.tmp && mv /tmp/oim.tmp ${path}/oim/Disk1/install/${oimInstallDir}/oraparam.ini",
  205. require => [Exec["extract ${oimFile1}"],Exec["extract ${oimFile2}"]],
  206. }
  207. exec { "install oim ${title}":
  208. command => "${path}/oim/Disk1/install/${oimInstallDir}/runInstaller ${command} -invPtrLoc /var/opt/oraInst.loc -ignoreSysPrereqs -jreLoc ${jreLocDir}",
  209. require => [File["${path}/${title}silent_oim.xml"],Exec["extract ${oimFile1}"],Exec["extract ${oimFile2}"],Exec["add -d64 oraparam.ini oim"]],
  210. creates => $oimOracleHome,
  211. timeout => 0,
  212. }
  213. }
  214. windows: {
  215. if $remoteFile == true {
  216. exec { "extract ${oimFile1}":
  217. command => "${checkCommand} unzip ${path}/${oimFile1} -d ${path}/oim",
  218. require => [Registry_Value ["HKEY_LOCAL_MACHINE\\SOFTWARE\\Oracle\\inst_loc"],File ["${path}/${oimFile1}"]],
  219. creates => "${path}/oim/Disk1",
  220. }
  221. exec { "extract ${oimFile2}":
  222. command => "${checkCommand} unzip ${path}/${oimFile2} -d ${path}/oim",
  223. require => [Exec["extract ${oimFile1}"],File ["${path}/${oimFile2}"]],
  224. creates => "${path}/oim/Disk3",
  225. }
  226. } else {
  227. exec { "extract ${oimFile1}":
  228. command => "${checkCommand} unzip ${puppetDownloadMntPoint}/${oimFile1} -d ${path}/oim",
  229. require => [Registry_Value ["HKEY_LOCAL_MACHINE\\SOFTWARE\\Oracle\\inst_loc"]],
  230. creates => "${path}/oim/Disk1",
  231. }
  232. exec { "extract ${oimFile2}":
  233. command => "${checkCommand} unzip ${puppetDownloadMntPoint}/${oimFile2} -d ${path}/oim",
  234. require => [Exec["extract ${oimFile1}"]],
  235. creates => "${path}/oim/Disk3",
  236. }
  237. }
  238. exec {"icacls oim disk ${title}":
  239. command => "${checkCommand} icacls ${path}\\oim\\* /T /C /grant Administrator:F Administrators:F",
  240. logoutput => false,
  241. require => [Exec["extract ${oimFile2}"],Exec["extract ${oimFile1}"]],
  242. }
  243. exec { "install oim ${title}":
  244. command => "${path}\\oim\\Disk1\\setup.exe ${command} -ignoreSysPrereqs -jreLoc C:\\oracle\\${fullJDKName}",
  245. logoutput => true,
  246. require => [Exec["icacls oim disk ${title}"],File["${path}/${title}silent_oim.xml"],Exec["extract ${oimFile2}"],Exec["extract ${oimFile1}"]],
  247. creates => $oimOracleHome,
  248. timeout => 0,
  249. }
  250. }
  251. }
  252. }
  253. }