changefmwlogdir.pp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. # == Define: wls::changefmwlogdir
  2. #
  3. # generic changefmwlogdir wlst script, runs the WLST command from the oracle common home
  4. # Moves the fmw log files like AdminServer-diagnostic.log or AdminServer-owsm.log
  5. # to a different location outside your domain
  6. #
  7. # pass on the weblogic username or password
  8. # or provide userConfigFile and userKeyFile file locations
  9. #
  10. # === Examples
  11. #
  12. # # set the defaults
  13. #
  14. # Wls::Changefmwlogdir {
  15. # mdwHome => $osMdwHome,
  16. # user => 'oracle',
  17. # group => 'dba',
  18. # }
  19. #
  20. # wls::changefmwlogdir{
  21. # 'adminServer':
  22. # address => "localhost",
  23. # wlsUser => "weblogic",
  24. # password => "weblogic1",
  25. # port => "7001",
  26. # wlsServer => "AdminServer",
  27. # logDir => "/data/logs",
  28. # downloadDir => "/install/",
  29. # }
  30. #
  31. #
  32. #
  33. define wls::changefmwlogdir ($mdwHome = undef,
  34. $address = "localhost",
  35. $port = '7001',
  36. $wlsUser = undef,
  37. $password = undef,
  38. $userConfigFile = undef,
  39. $userKeyFile = undef,
  40. $user = 'oracle',
  41. $group = 'dba',
  42. $wlsServer = undef,
  43. $logDir = undef,
  44. $downloadDir = '/install',
  45. $logOutput = false,
  46. ) {
  47. case $operatingsystem {
  48. CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES, Solaris: {
  49. $execPath = "/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:"
  50. $path = $downloadDir
  51. Exec { path => $execPath,
  52. user => $user,
  53. group => $group,
  54. logoutput => $logOutput,
  55. }
  56. File {
  57. ensure => present,
  58. replace => true,
  59. mode => 0555,
  60. owner => $user,
  61. group => $group,
  62. backup => false,
  63. }
  64. }
  65. windows: {
  66. $execPath = "C:\\unxutils\\bin;C:\\unxutils\\usr\\local\\wbin;C:\\Windows\\system32;C:\\Windows"
  67. $path = $downloadDir
  68. Exec { path => $execPath,
  69. logoutput => $logOutput,
  70. }
  71. File { ensure => present,
  72. replace => true,
  73. mode => 0777,
  74. backup => false,
  75. }
  76. }
  77. }
  78. # use userConfigStore for the connect
  79. if $password == undef {
  80. $useStoreConfig = true
  81. } else {
  82. $useStoreConfig = false
  83. }
  84. # the py script used by the wlst
  85. file { "${path}/${title}changeFMWLogFolder.py":
  86. path => "${path}/${title}changeFMWLogFolder.py",
  87. content => template("wls/wlst/changeFMWLogFolder.py.erb"),
  88. }
  89. case $operatingsystem {
  90. CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES: {
  91. exec { "execwlst ${title}changeFMWLogFolder.py":
  92. command => "${mdwHome}/oracle_common/common/bin/wlst.sh ${path}/${title}changeFMWLogFolder.py",
  93. unless => "ls -l ${logDir}/${wlsServer}-diagnostic.log",
  94. require => File["${path}/${title}changeFMWLogFolder.py"],
  95. }
  96. }
  97. windows: {
  98. exec { "execwlst ${title}changeFMWLogFolder.py":
  99. command => "C:\\Windows\\System32\\cmd.exe /c ${mdwHome}/oracle_common/common/bin/wlst.cmd ${path}/${title}changeFMWLogFolder.py",
  100. unless => "C:\\Windows\\System32\\cmd.exe /c dir ${logDir}/${wlsServer}-diagnostic.log",
  101. require => File["${path}/${title}changeFMWLogFolder.py"],
  102. }
  103. }
  104. }
  105. }