rcu.pp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. # == Class: wls::utils::rcu
  2. # rcu for adf 12.1.2
  3. #
  4. # wls::utils::rcu{ 'DEV3_12c':
  5. # product => 'adf',
  6. # oracleHome => '/oracle/product/11.2/db',
  7. # user => 'oracle',
  8. # group => 'dba',
  9. # downloadDir => '/install',
  10. # action => 'create',
  11. # dbUrl => 'dbagent2.alfa.local:1521/test.oracle.com',
  12. # sysPassword => 'Welcome01',
  13. # schemaPrefix => 'DEV',
  14. # reposPassword => 'Welcome02',
  15. # }
  16. #
  17. #
  18. define wls::utils::rcu( $product = 'adf',
  19. $oracleHome = undef,
  20. $fullJDKName = undef,
  21. $user = 'oracle',
  22. $group = 'dba',
  23. $downloadDir = '/install',
  24. $action = 'create',
  25. $dbUrl = undef,
  26. $sysPassword = undef,
  27. $schemaPrefix = undef,
  28. $reposPassword = undef,
  29. ){
  30. case $operatingsystem {
  31. CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES, Solaris: {
  32. $execPath = "/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:"
  33. $path = $downloadDir
  34. Exec { path => $execPath,
  35. user => $user,
  36. group => $group,
  37. logoutput => true,
  38. }
  39. File {
  40. ensure => present,
  41. mode => 0775,
  42. owner => $user,
  43. group => $group,
  44. }
  45. }
  46. windows: {
  47. $execPath = "C:\\unxutils\\bin;C:\\unxutils\\usr\\local\\wbin;C:\\Windows\\system32;C:\\Windows"
  48. $checkCommand = "C:\\Windows\\System32\\cmd.exe /c"
  49. $path = $downloadDir
  50. Exec { path => $execPath,
  51. }
  52. File { ensure => present,
  53. mode => 0777,
  54. }
  55. }
  56. default: {
  57. fail("Unrecognized operating system")
  58. }
  59. }
  60. if $product == 'adf' {
  61. $components = '-component MDS -component IAU -component IAU_APPEND -component IAU_VIEWER -component OPSS -component WLS -component UCSCC '
  62. $componentsPasswords = [$reposPassword, $reposPassword, $reposPassword,$reposPassword,$reposPassword,$reposPassword,$reposPassword]
  63. } else {
  64. fail("Unrecognized FMW product")
  65. }
  66. file { "${path}/rcu_passwords_${product}_${action}.txt":
  67. ensure => present,
  68. content => template("wls/utils/rcu_passwords.txt.erb"),
  69. }
  70. case $operatingsystem {
  71. CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES: {
  72. $script = "${oracleHome}/bin/rcu"
  73. $javaHome = "/usr/java/${fullJDKName}"
  74. }
  75. Solaris: {
  76. $javaHome = "/usr/jdk/${fullJDKName}"
  77. }
  78. windows: {
  79. $script = "${checkCommand} ${oracleHome}/bin/rcu.bat"
  80. $javaHome = "C:\\oracle\\${fullJDKName}"
  81. }
  82. }
  83. if $action == 'create' {
  84. exec { "install rcu repos ${title}":
  85. command => "${script} -silent -createRepository -databaseType ORACLE -connectString ${dbUrl} -dbUser SYS -dbRole SYSDBA -schemaPrefix ${schemaPrefix} ${components} -f < ${path}/rcu_passwords_${product}_${action}.txt",
  86. require => File["${path}/rcu_passwords_${product}_${action}.txt"],
  87. environment => ["JAVA_HOME=${javaHome}","LANG='en_US.UTF8'","LC_ALL='en_US.UTF8'","NLS_LANG='american_america'"],
  88. }
  89. } elsif $action == 'delete' {
  90. exec { "delete rcu repos ${title}":
  91. command => "${script} -silent -dropRepository -databaseType ORACLE -connectString ${dbUrl} -dbUser SYS -dbRole SYSDBA -schemaPrefix ${schemaPrefix} ${components} -f < ${path}/rcu_passwords_${product}_${action}.txt",
  92. require => File["${path}/rcu_passwords_${product}_${action}.txt"],
  93. environment => ["JAVA_HOME=${javaHome}"],
  94. }
  95. }
  96. }