puppet 依赖关系
1,require , 表示执行所在的资源必须需要的资源,并且正确执行后, 表示执行sudo::file 必须先有sudo::install。
class sudo::file {
file { "/etc/sudoers":
source => 'puppet:///modules/sudo/etc/sudoers',
ensure => 'present',
owner => root,
mode => 0440,
group => root,
require => Class['sudo::install'],
}
}
2,before , 表示执行所在的资源以后,随后执行的资源,表示执行sudo::install,随后执行before
class sudo::install {
package { "sudo" :
ensure => 'present',
before => Class["sudo::file"],
}
}
与before对应的是after
3,notify , 表示所在的资源发生变动后,所通知的执行的资源, 表示当puppet::config 发生变化时,需要执行Class["puppet::server"],
class puppet::config {
file { "/etc/puppet/puppet.conf" :
source => 'puppet:///modules/puppet/puppet.conf',
ensure => 'present',
mode => '0744',
owner => 'puppet',
group => 'puppet',
notify => Class["puppet::server"],
}
}
与notify对应的是subscribe .
阅读(2712) | 评论(0) | 转发(0) |