|
[root@pps modules]# tree jdk/
jdk/
|-- files
|-- manifests
| `-- init.pp
`-- templates
`-- profile.erb
3 directories, 2 files
- class jdk{
- #下载jdk安装包
- file {"/tmp/jdk-6u33-linux-x64-rpm.bin":
- owner=> root,
- group=>root,
- mode=>755,
- source=>"puppet://pps.zhaizu.com/files/jdk-6u33-linux-x64-rpm.bin",
- recurse=>true,
- }
- #下载file配置文件用户追加到/etc/profile
- file {
- "profile":
- owner => root,
- group => root,
- mode => 755,
- ensure => present,
- name => "/tmp/profile",
- content => template("jdk/profile.erb"),
- require =>File["/tmp/jdk-6u33-linux-x64-rpm.bin"],
- before =>Exec["build-jdk"],
- }
- #安装jdk
- exec {"build-jdk":
- cwd =>"/tmp",
- command => "/bin/sh jdk-6u33-linux-x64-rpm.bin ",
- require => File["/tmp/jdk-6u33-linux-x64-rpm.bin"],
- # before => File["cat-profile"],
- notify => Exec['cat-profile'],
- }
- #追加配置文件到/etc/profile,其中refreshonly表示
- exec {"cat-profile":
- cwd =>"/tmp",
- command => "/bin/cat /tmp/profile >> /etc/profile",
- require =>File["profile"],
- refreshonly => true, #避免重复执行追加动作
- }
- }
|
|
|