oimconfig.pp 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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. backup => false,
  49. }
  50. }
  51. Solaris: {
  52. $execPath = "/usr/jdk/${fullJDKName}/bin/amd64:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:"
  53. $path = $downloadDir
  54. $oimInstallDir = "intelsolaris"
  55. $jreLocDir = "/usr/jdk/${fullJDKName}"
  56. Exec { path => $execPath,
  57. user => $user,
  58. group => $group,
  59. logoutput => true,
  60. }
  61. File {
  62. ensure => present,
  63. mode => 0775,
  64. owner => $user,
  65. group => $group,
  66. backup => false,
  67. }
  68. }
  69. }
  70. if ( $remoteConfig == true ) {
  71. file { "${path}/${title}config_oim_remote.rsp":
  72. ensure => present,
  73. content => template("wls/oim/oim_remote.rsp.erb"),
  74. }
  75. exec { "config oim remote ${title}":
  76. command => "${oimHome}/bin/config.sh -silent -response ${path}/${title}config_oim_remote.rsp",
  77. timeout => 0,
  78. onlyif => "${remoteConfig} == true",
  79. require => File["${path}/${title}config_oim_remote.rsp"],
  80. }
  81. }
  82. if ( $designConfig == true ) {
  83. file { "${path}/${title}config_oim_design.rsp":
  84. ensure => present,
  85. content => template("wls/oim/oim_design.rsp.erb"),
  86. }
  87. exec { "config oim design ${title}":
  88. command => "${oimHome}/bin/config.sh -silent -response ${path}/${title}config_oim_design.rsp",
  89. timeout => 0,
  90. require => File["${path}/${title}config_oim_design.rsp"],
  91. }
  92. }
  93. if ( $serverConfig ) {
  94. # if these params are empty always continue
  95. if $wlsDomain != undef {
  96. # check if oim is already configured in this weblogic domain
  97. $oimValue = oim_configured( $wlsDomain , "1121" )
  98. } else {
  99. fail("wlsDomain parameter is empty ")
  100. }
  101. if ( $oimValue == false ) {
  102. file { "${path}/${title}config_oim_server.rsp":
  103. ensure => present,
  104. content => template("wls/oim/oim_server.rsp.erb"),
  105. }
  106. if $::override_weblogic_domain_folder == undef {
  107. $domainsHome = "${wlHome}/../user_projects/domains"
  108. } else {
  109. $domainsHome = "${::override_weblogic_domain_folder}/domains"
  110. }
  111. exec { "config oim server ${title}":
  112. command => "${oimHome}/bin/config.sh -silent -response ${path}/${title}config_oim_server.rsp",
  113. timeout => 0,
  114. require => File["${path}/${title}config_oim_server.rsp"],
  115. creates => "${domainsHome}/${wlsDomain}/soa/autodeploy",
  116. }
  117. Wls::Wlscontrol{
  118. wlsDomain => $wlsDomain,
  119. wlsDomainPath => "${domainsHome}/${wlsDomain}",
  120. wlHome => $wlHome,
  121. fullJDKName => $fullJDKName,
  122. wlsUser => $wlsUser,
  123. password => $password,
  124. address => $adminServerAddress,
  125. user => $user,
  126. group => $group,
  127. downloadDir => $downloadDir,
  128. logOutput => true,
  129. }
  130. # stop Oim server for configuration
  131. wls::wlscontrol{'stopOIMOimServer1AfterConfig':
  132. wlsServerType => 'managed',
  133. wlsServer => $oimServerName,
  134. action => 'stop',
  135. port => $adminServerport,
  136. require => Exec["config oim server ${title}"],
  137. }
  138. # stop Oim server for configuration
  139. wls::wlscontrol{'stopOIMSoaServer1AfterConfig':
  140. wlsServerType => 'managed',
  141. wlsServer => $soaServerName,
  142. action => 'stop',
  143. port => $adminServerport,
  144. require => [Wls::Wlscontrol['stopOIMOimServer1AfterConfig'],Exec["config oim server ${title}"]],
  145. }
  146. # stop AdminServer for configuration
  147. wls::wlscontrol{'stopOIMAdminServerAfterConfig':
  148. wlsServerType => 'admin',
  149. wlsServer => $adminServerName,
  150. action => 'stop',
  151. port => $nodemanagerPort,
  152. require => [Wls::Wlscontrol['stopOIMOimServer1AfterConfig'],Wls::Wlscontrol['stopOIMSoaServer1AfterConfig'],Exec["config oim server ${title}"]],
  153. }
  154. # start AdminServer for configuration
  155. wls::wlscontrol{'startOIMAdminServerAfterConfig':
  156. wlsServerType => 'admin',
  157. wlsServer => $adminServerName,
  158. action => 'start',
  159. port => $nodemanagerPort,
  160. require => [Wls::Wlscontrol['stopOIMOimServer1AfterConfig'],Wls::Wlscontrol['stopOIMAdminServerAfterConfig'],Wls::Wlscontrol['stopOIMSoaServer1AfterConfig'],Exec["config oim server ${title}"]],
  161. }
  162. }
  163. }
  164. }