goldengate.pp 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #
  2. #
  3. #
  4. define oradb::goldengate( $version = '12.1.2',
  5. $file = undef,
  6. $tarFile = undef, # only for < 12.1.2
  7. $databaseType = 'Oracle', # only for > 12.1.2
  8. $databaseVersion = 'ORA11g', # 'ORA11g'|'ORA12c' only for > 12.1.2
  9. $databaseHome = undef, # only for > 12.1.2
  10. $oracleBase = undef, # only for > 12.1.2
  11. $goldengateHome = undef,
  12. $managerPort = undef,
  13. $user = 'ggate',
  14. $group = 'dba',
  15. $group_install = 'oinstall',
  16. $downloadDir = '/install',
  17. $puppetDownloadMntPoint = undef,
  18. )
  19. {
  20. if ( $version == '12.1.2' ) {
  21. # check if the oracle software already exists
  22. $found = oracle_exists( $goldengateHome )
  23. if $found == undef {
  24. $continue = true
  25. } else {
  26. if ( $found ) {
  27. $continue = false
  28. } else {
  29. notify {"oradb::goldengate ${goldengateHome} does not exists":}
  30. $continue = true
  31. }
  32. }
  33. } else {
  34. $continue = false
  35. }
  36. # only for 12.1.2
  37. if ( $continue == true ) {
  38. $oraInventory = "${oracleBase}/oraInventory"
  39. $ggateInstallDir = 'fbo_ggs_Linux_x64_shiphome'
  40. file { "${downloadDir}/${file}":
  41. source => "${puppetDownloadMntPoint}/${file}",
  42. owner => $user,
  43. group => $group,
  44. }
  45. exec { "extract gg":
  46. command => "unzip -o ${downloadDir}/${file} -d ${downloadDir}",
  47. require => File["${downloadDir}/${file}"],
  48. creates => "${downloadDir}/${ggateInstallDir}",
  49. timeout => 0,
  50. path => "/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin",
  51. user => $user,
  52. group => $group,
  53. logoutput => true,
  54. }
  55. file { "${downloadDir}/oggcore.rsp":
  56. content => template("oradb/oggcore_${version}.rsp.erb"),
  57. owner => $user,
  58. group => $group,
  59. }
  60. oradb::utils::orainst{"ggate orainst ${version}":
  61. ora_inventory_dir => $oraInventory,
  62. os_group => $group_install,
  63. }
  64. exec { "install oracle goldengate":
  65. command => "/bin/sh -c 'unset DISPLAY;${downloadDir}/${ggateInstallDir}/Disk1/runInstaller -silent -waitforcompletion -responseFile ${downloadDir}/oggcore.rsp'",
  66. require => [ File["${downloadDir}/oggcore.rsp"],
  67. Oradb::Utils::Orainst["ggate orainst ${version}"],
  68. Exec["extract gg"]
  69. ],
  70. creates => $goldengateHome,
  71. timeout => 0,
  72. path => "/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin",
  73. logoutput => true,
  74. user => $user,
  75. group => $group_install,
  76. returns => [3,0],
  77. }
  78. } else {
  79. #version is different, use the old way
  80. file { "${downloadDir}/${file}":
  81. source => "${puppetDownloadMntPoint}/${file}",
  82. owner => $user,
  83. group => $group,
  84. }
  85. exec { "extract gg ${title}":
  86. command => "unzip -o ${downloadDir}/${file} -d ${downloadDir}",
  87. require => File["${downloadDir}/${file}"],
  88. creates => "${downloadDir}/${tarFile}",
  89. timeout => 0,
  90. path => "/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin",
  91. user => $user,
  92. group => $group,
  93. logoutput => true,
  94. }
  95. file { $goldengateHome :
  96. ensure => directory,
  97. recurse => false,
  98. replace => false,
  99. mode => '0775',
  100. owner => $user,
  101. group => $group,
  102. }
  103. exec { "extract tar ${title}":
  104. command => "tar -xf ${downloadDir}/${tarFile} -C ${goldengateHome}",
  105. require => [File[$goldengateHome],Exec["extract gg ${title}"]],
  106. creates => "${goldengateHome}/ggsci",
  107. timeout => 0,
  108. path => "/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin",
  109. user => $user,
  110. group => $group,
  111. logoutput => true,
  112. }
  113. }
  114. }