storeuserconfig.pp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. # == Define: wls::storeuserconfig
  2. #
  3. # generic storeuserconfig wlst script
  4. #
  5. #
  6. # === Examples
  7. #
  8. #
  9. # wls::storeuserconfig{
  10. # 'adminServer':
  11. # wlHome => "/opt/oracle/wls/wls11g/wlserver_10.3",
  12. # fullJDKName => $jdkWls11gJDK,
  13. # domain => 'osbSoaDomain',
  14. # address => "localhost",
  15. # wlsUser => "weblogic",
  16. # password => "weblogic1",
  17. # port => "7001",
  18. # user => 'oracle',
  19. # group => 'dba',
  20. # userConfigDir => '/home/oracle',
  21. # downloadDir => "/install/",
  22. # }
  23. #
  24. #
  25. #
  26. define wls::storeuserconfig( $wlHome = undef,
  27. $fullJDKName = undef,
  28. $domain = undef,
  29. $address = "localhost",
  30. $port = '7001',
  31. $wlsUser = "weblogic",
  32. $password = "weblogic1",
  33. $user = 'oracle',
  34. $group = 'dba',
  35. $userConfigDir = '/home/oracle',
  36. $downloadDir = '/install/',
  37. $logOutput = false,
  38. ) {
  39. $javaCommand = "java -Dweblogic.management.confirmKeyfileCreation=true -Dweblogic.security.SSL.ignoreHostnameVerification=true weblogic.WLST -skipWLSModuleScanning "
  40. case $operatingsystem {
  41. CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES: {
  42. $execPath = "/usr/java/${fullJDKName}/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:"
  43. $path = $downloadDir
  44. $JAVA_HOME = "/usr/java/${fullJDKName}"
  45. Exec { path => $execPath,
  46. user => $user,
  47. group => $group,
  48. logoutput => $logOutput,
  49. }
  50. File {
  51. ensure => present,
  52. replace => 'yes',
  53. mode => 0555,
  54. owner => $user,
  55. group => $group,
  56. }
  57. }
  58. Solaris: {
  59. $execPath = "/usr/jdk/${fullJDKName}/bin/amd64:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:"
  60. $path = $downloadDir
  61. $JAVA_HOME = "/usr/jdk/${fullJDKName}"
  62. Exec { path => $execPath,
  63. user => $user,
  64. group => $group,
  65. logoutput => $logOutput,
  66. }
  67. File {
  68. ensure => present,
  69. replace => 'yes',
  70. mode => 0555,
  71. owner => $user,
  72. group => $group,
  73. }
  74. }
  75. windows: {
  76. $execPath = "C:\\oracle\\${fullJDKName}\\bin;C:\\unxutils\\bin;C:\\unxutils\\usr\\local\\wbin;C:\\Windows\\system32;C:\\Windows"
  77. $path = $downloadDir
  78. $JAVA_HOME = "c:\\oracle\\${fullJDKName}"
  79. Exec { path => $execPath,
  80. logoutput => $logOutput,
  81. }
  82. File { ensure => present,
  83. replace => 'yes',
  84. mode => 0777,
  85. }
  86. }
  87. }
  88. # the py script used by the wlst
  89. file { "${path}/${title}storeUserConfig.py":
  90. path => "${path}/${title}storeUserConfig.py",
  91. content => template("wls/wlst/storeUserConfig.py.erb"),
  92. }
  93. case $operatingsystem {
  94. CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES, Solaris: {
  95. exec { "execwlst ${title}storeUserConfig.py":
  96. command => "${javaCommand} ${path}/${title}storeUserConfig.py ${password}",
  97. environment => ["CLASSPATH=${wlHome}/server/lib/weblogic.jar",
  98. "JAVA_HOME=${JAVA_HOME}"],
  99. unless => "ls -l ${userConfigDir}/${user}-${$domain}-WebLogicConfig.properties",
  100. require => File["${path}/${title}storeUserConfig.py"],
  101. }
  102. }
  103. windows: {
  104. exec { "execwlst ${title}storeUserConfig.py":
  105. command => "C:\\Windows\\System32\\cmd.exe /c ${javaCommand} ${path}/${title}storeUserConfig.py ${password}",
  106. unless => "C:\\Windows\\System32\\cmd.exe /c dir ${userConfigDir}/${user}-${domain}-WebLogicConfig.properties",
  107. require => File["${path}/${title}storeUserConfig.py"],
  108. environment => ["CLASSPATH=${wlHome}\\server\\lib\\weblogic.jar",
  109. "JAVA_HOME=${JAVA_HOME}"],
  110. }
  111. }
  112. }
  113. }