为什么有两种类型的Puppet'Exec'和Puppet'exec'

时间:2014-01-07 09:45:46

标签: puppet

这将是一个Noob问题。

为什么Puppet,Exec和exec中有两种类型的Exec。我找不到两者之间的区别。

Exec {
    path => ["/usr/bin", "/bin", "/usr/sbin", "/sbin", "/usr/local/bin","/usr/local/sbin"]
}

#execute the following command
exec { 

     #this is our command name
    'apt-get update':

    #the command to be executed
    command => '/usr/bin/apt-get update',

    #where we can find the required command
    require => Exec['add php54 apt-repo']
}

2 个答案:

答案 0 :(得分:5)

在您的代码中,您可以看到关键字exec的三种不同用法:

第一个

Exec {
    path => ["/usr/bin", "/bin", "/usr/sbin", "/sbin", "/usr/local/bin","/usr/local/sbin"]
}

更改资源Exec的属性路径的默认值。

第二个:

#execute the following command
exec { 

     #this is our command name
    'apt-get update':

创建资源的实例

第三个:

require => Exec['add php54 apt-repo']

是指使用他的名字的现有实例('add php54 apt-repo')

答案 1 :(得分:2)

只有一种资源类型,当使用大写时,您正在执行资源引用[1],它会影响适用范围内该类型的所有资源。

[1] http://docs.puppetlabs.com/puppet/3/reference/lang_resources.html#amending-attributes-with-a-reference

相关问题