puppet配備jdk


[root@pps modules]# tree jdk/jdk/|-- files |-- manifests |   `-- init.pp `-- templates     `-- profile.erb 3 directories, 2 files

  
  
  
  
  1. class jdk{ 
  2. # jdk
  3. file {"/tmp/jdk-6u33-linux-x64-rpm.bin": 
  4.         owner=> root, 
  5.         group=>root, 
  6.         mode=>755, 
  7.         source=>"puppet://pps.zhaizu.com/files/jdk-6u33-linux-x64-rpm.bin", 
  8.         recurse=>true, 
  9.  
  10.  # file /etc/profile
  11. file { 
  12. "profile": 
  13.         owner => root, 
  14.         group => root, 
  15.         mode => 755, 
  16.         ensure => present, 
  17.         name => "/tmp/profile", 
  18.         content => template("jdk/profile.erb"), 
  19.         require =>File["/tmp/jdk-6u33-linux-x64-rpm.bin"], 
  20.         before =>Exec["build-jdk"], 
  21.  
  22.  
  23. # jdk
  24. exec {"build-jdk": 
  25.         cwd =>"/tmp", 
  26.         command => "/bin/sh jdk-6u33-linux-x64-rpm.bin ", 
  27.         require => File["/tmp/jdk-6u33-linux-x64-rpm.bin"], 
  28. #       before => File["cat-profile"], 
  29.         notify => Exec['cat-profile'], 
  30.  
  31. # /etc/profile, refreshonly
  32. exec {"cat-profile": 
  33.         cwd =>"/tmp", 
  34.         command => "/bin/cat  /tmp/profile >> /etc/profile", 
  35.         require =>File["profile"], 
  36.  
  37.         refreshonly => true, #

 
本文は“風光悪党”のブログから出て、転載して作者と連絡してください!