oimconfig.pp 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. # == Define: wls::oimconfig
  2. #
  3. # does all the Oracle Identity Management configuration
  4. #
  5. define wls::oimconfig ($oimHome = undef,
  6. $fullJDKName = undef,
  7. $serverConfig = false,
  8. $oimDatabaseUrl = undef,
  9. $oimSchemaPrefix = undef,
  10. $oimSchemaPassword = undef,
  11. $wlsUser = undef,
  12. $password = undef,
  13. $oimPassword = undef,
  14. $remoteConfig = false,
  15. $keystorePassword = undef,
  16. $designConfig = false,
  17. $oimServerHostname = undef,
  18. $oimServerPort = 14000,
  19. $user = 'oracle',
  20. $group = 'dba',
  21. $downloadDir = '/install',
  22. $wlHome = undef,
  23. $mdwHome = undef,
  24. $wlsDomain = undef,
  25. $adminServerName = undef,
  26. $soaServerName = undef,
  27. $oimServerName = undef,
  28. $adminServerAddress = 'localhost',
  29. $adminServerport = 7001,
  30. $nodemanagerPort = 5556,
  31. ) {
  32. case $operatingsystem {
  33. CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES: {
  34. $execPath = "/usr/java/${fullJDKName}/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:"
  35. $path = $downloadDir
  36. $oimInstallDir = "linux64"
  37. $jreLocDir = "/usr/java/${fullJDKName}"
  38. Exec { path => $execPath,
  39. user => $user,
  40. group => $group,
  41. logoutput => true,
  42. }
  43. File {
  44. ensure => present,
  45. mode => 0775,
  46. owner => $user,
  47. group => $group,
  48. }
  49. }
  50. Solaris: {
  51. $execPath = "/usr/jdk/${fullJDKName}/bin/amd64:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:"
  52. $path = $downloadDir
  53. $oimInstallDir = "intelsolaris"
  54. $jreLocDir = "/usr/jdk/${fullJDKName}"
  55. Exec { path => $execPath,
  56. user => $user,
  57. group => $group,
  58. logoutput => true,
  59. }
  60. File {
  61. ensure => present,
  62. mode => 0775,
  63. owner => $user,
  64. group => $group,
  65. }
  66. }
  67. }
  68. if ( $remoteConfig == true ) {
  69. file { "${path}/${title}config_oim_remote.rsp":
  70. ensure => present,
  71. content => template("wls/oim/oim_remote.rsp.erb"),
  72. }
  73. exec { "config oim remote ${title}":
  74. command => "${oimHome}/bin/config.sh -silent -response ${path}/${title}config_oim_remote.rsp",
  75. timeout => 0,
  76. onlyif => "${remoteConfig} == true",
  77. require => File["${path}/${title}config_oim_remote.rsp"],
  78. }
  79. }
  80. if ( $designConfig == true ) {
  81. file { "${path}/${title}config_oim_design.rsp":
  82. ensure => present,
  83. content => template("wls/oim/oim_design.rsp.erb"),
  84. }
  85. exec { "config oim design ${title}":
  86. command => "${oimHome}/bin/config.sh -silent -response ${path}/${title}config_oim_design.rsp",
  87. timeout => 0,
  88. require => File["${path}/${title}config_oim_design.rsp"],
  89. }
  90. }
  91. if ( $serverConfig ) {
  92. # if these params are empty always continue
  93. if $wlsDomain != undef {
  94. # check if oim is already configured in this weblogic domain
  95. $oimValue = oim_configured( $wlsDomain , "1121" )
  96. } else {
  97. fail("wlsDomain parameter is empty ")
  98. }
  99. if ( $oimValue == "false" ) {
  100. file { "${path}/${title}config_oim_server.rsp":
  101. ensure => present,
  102. content => template("wls/oim/oim_server.rsp.erb"),
  103. }
  104. exec { "config oim server ${title}":
  105. command => "${oimHome}/bin/config.sh -silent -response ${path}/${title}config_oim_server.rsp",
  106. timeout => 0,
  107. require => File["${path}/${title}config_oim_server.rsp"],
  108. creates => "${mdwHome}/user_projects/domains/${wlsDomain}/soa/autodeploy",
  109. }
  110. Wls::Wlscontrol{
  111. wlsDomain => $wlsDomain,
  112. wlsDomainPath => "${mdwHome}/user_projects/domains/${wlsDomain}",
  113. wlHome => $wlHome,
  114. fullJDKName => $fullJDKName,
  115. wlsUser => $wlsUser,
  116. password => $password,
  117. address => $adminServerAddress,
  118. user => $user,
  119. group => $group,
  120. downloadDir => $downloadDir,
  121. logOutput => true,
  122. }
  123. # stop Oim server for configuration
  124. wls::wlscontrol{'stopOIMOimServer1AfterConfig':
  125. wlsServerType => 'managed',
  126. wlsServer => $oimServerName,
  127. action => 'stop',
  128. port => $adminServerport,
  129. require => Exec["config oim server ${title}"],
  130. }
  131. # stop Oim server for configuration
  132. wls::wlscontrol{'stopOIMSoaServer1AfterConfig':
  133. wlsServerType => 'managed',
  134. wlsServer => $soaServerName,
  135. action => 'stop',
  136. port => $adminServerport,
  137. require => [Wls::Wlscontrol['stopOIMOimServer1AfterConfig'],Exec["config oim server ${title}"]],
  138. }
  139. # stop AdminServer for configuration
  140. wls::wlscontrol{'stopOIMAdminServerAfterConfig':
  141. wlsServerType => 'admin',
  142. wlsServer => $adminServerName,
  143. action => 'stop',
  144. port => $nodemanagerPort,
  145. require => [Wls::Wlscontrol['stopOIMOimServer1AfterConfig'],Wls::Wlscontrol['stopOIMSoaServer1AfterConfig'],Exec["config oim server ${title}"]],
  146. }
  147. # start AdminServer for configuration
  148. wls::wlscontrol{'startOIMAdminServerAfterConfig':
  149. wlsServerType => 'admin',
  150. wlsServer => $adminServerName,
  151. action => 'start',
  152. port => $nodemanagerPort,
  153. require => [Wls::Wlscontrol['stopOIMOimServer1AfterConfig'],Wls::Wlscontrol['stopOIMAdminServerAfterConfig'],Wls::Wlscontrol['stopOIMSoaServer1AfterConfig'],Exec["config oim server ${title}"]],
  154. }
  155. }
  156. }
  157. }