class ceshi {
file {["/data","/data/soft","/data/soft/abc","/data/soft/abc/123"]:
ensure => directory,
before => Group[www],
}
group {'www':
gid => 1002,
ensure => present,
}
user { 'www':
gid => 1002,
ensure =>present,
home => '/dev/null',
shell => '/bin/bash',
managehome => false,
require => Group['www'],
}
file { 'f':
name => '/data/soft/abc/123/f',
ensure => present,
recurse => true,
require =>User['www'],
mode => '0755',
owner => 'www',
group => 'www',
source => 'puppet:///modules/ceshi/f',
}
}
file 下 ensure 可以为directory,这样就是建立目录。和文件一样,建立目录的时候,必须上层目录是存在的,否则建立失败,
但是puppet 支持数组,这样可以直接将数组的中的目录,
键before后面为本次资源执行完后执行的资源,例: before => Group[www]。
键require后面为本次资源执行前执行的资源。
阅读(2644) | 评论(0) | 转发(0) |