Advertisement
Guest User

Untitled

a guest
Oct 26th, 2012
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.54 KB | None | 0 0
  1. class oracle10g{
  2. # Get files from NFS server or install From NFS server
  3. # require oracle validated to be installed
  4.  
  5. # We need some way to check to see if oracle is installed that is reliable
  6. # Currently if the /opt/oracle is less than 5 bytes than I can assume its not installed
  7. # If its greater than 5 bytes than we better not mess with the directory
  8.  
  9.  
  10.  
  11. # This will let us know if we have already started a transfer or install, in the event that it tries to restart
  12. exec { "start_transfer":
  13. creates => "/home/oracle/transfer_started.txt",
  14. unless => ["test -d /opt/oracle/product/10.2.0"],
  15.  
  16. }
  17. # This is the oracle response files that I created during an oracle base install
  18. file { "/home/oracle/oracle10gresponse.txt":
  19. owner => "oracle",
  20. group => "dba",
  21. mode => "0644",
  22. source => "puppet:///files/oracle10gresponse.txt",
  23. unless => ["test -d /opt/oracle/product/10.2.0"],
  24.  
  25.  
  26. }
  27. # This is the oracle response files that I created during an oracle upgrade install
  28.  
  29. file { "/home/oracle/oracle10gpatchresponse.txt":
  30. owner => "oracle",
  31. group => "dba",
  32. mode => "0644",
  33. source => "puppet:///files/oracle10gpatchresponse.txt",
  34. unless => ["test -d /opt/oracle/product/10.2.0"],
  35.  
  36. }
  37. # It would be nice to have a way to see if we need to transfer a file or work from NFS
  38. # For now, lets assume we have lots of bandwidth
  39. file { "/home/oracle/oracle_install.tar.gz":
  40. owner => "oracle",
  41. group => "dba",
  42. mode => "0644",
  43. source => "puppet:///files/oracle_install.tar.gz",
  44. unless => ["test -d /opt/oracle/product/10.2.0"],
  45. }
  46. exec {"extract-oracle":
  47. user => oracle,
  48. command => "tar -zxvf oracle_install.tar.gz",
  49. require => File["/home/oracle/oracle_install.tar.gz"]
  50.  
  51. }
  52. # This will let us know if we have already started a transfer or install, in the event that it tries to restart
  53. exec { "start-install":
  54. creates => "/home/oracle/install_started.txt",
  55. require => Exec['extract-oracle'],
  56. }
  57.  
  58.  
  59. # this should be split off into baseinstaller, postinstaller and then a patch for loop class
  60. # In the future I may just create a type/provider for opatch
  61.  
  62. exec { "baseinstaller":
  63. command => "/home/oracle/oracle_install/database/runInstaller -silent -responseFile /home/oracle/oracle10gresponse.txt",
  64. path => "/home/oracle/oracle_install/database/",
  65. # only run if just the directory exists
  66. unless => ["test -d /opt/oracle/product/10.2.0"],
  67. # need to make sure the class oraclebase has installed everything needed
  68. require => [Class['oraclebase'],Exec['extract-oracle']],
  69. user => oracle
  70. }
  71.  
  72. exec { "postinstaller":
  73. command => "/home/oracle/oracle_install/Disk1/runInstaller -silent -responseFile /home/oracle/oracle10gpatchresponse.txt",
  74. path => "/home/oracle/oracle_install/Disk1/",
  75. creates => "/home/oracle/post_install_started.txt",
  76. require => Exec["baseinstaller"],
  77. user => oracle
  78. }
  79. exec { "patch_4311273":
  80. command => "cd /home/oracle/oracle_install/4311273; opatch apply",
  81. path => "/opt/oracle/product/10.2.0/db/OPatch/",
  82. require => Exec["postinstaller"],
  83. user => oracle
  84.  
  85.  
  86. }
  87. exec { "patch_5177766":
  88. command => "cd /home/oracle/oracle_install/5177766; opatch apply",
  89. path => "/opt/oracle/product/10.2.0/db/OPatch/",
  90. require => Exec["patch_4311273"],
  91. user => oracle
  92.  
  93.  
  94. }
  95. exec { "install_finished":
  96. creates => "/home/oracle/install_finished.txt",
  97. require => Exec["patch_5177766"]
  98.  
  99. }
  100.  
  101.  
  102.  
  103. # Start the Cleanup process and remove all files and directories
  104. # Don't do this if you decide to host everything on nfs
  105.  
  106. file { "remove_oracle10gresponse.txt":
  107. source => "/home/oracle/oracle10gresponse.txt",
  108. onlyif => ["test -d /home/oracle/install_finished.txt"],
  109. ensure => absent,
  110. }
  111.  
  112.  
  113. file { "remove_oracle10gpatchresponse.txt":
  114. source => "/home/oracle/oracle10gpatchresponse.txt",
  115. onlyif => ["test -d /home/oracle/install_finished.txt"],
  116. ensure => absent,
  117.  
  118. }
  119. file { "remove_oracle_install.tar.gz":
  120. source => "/home/oracle/oracle_install.tar.gz",
  121. onlyif => ["test -d /home/oracle/install_finished.txt"],
  122. ensure => absent,
  123.  
  124. }
  125. file { "remove_oracle_install":
  126. source => "/home/oracle/oracle_install",
  127. onlyif => ["test -d /home/oracle/install_finished.txt"],
  128. ensure => absent,
  129. recurse => true,
  130.  
  131. }
  132.  
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement