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

PR *_*ead 3 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']
}
Run Code Online (Sandbox Code Playgroud)

Rau*_*res 6

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

第一个

Exec {
    path => ["/usr/bin", "/bin", "/usr/sbin", "/sbin", "/usr/local/bin","/usr/local/sbin"]
}
Run Code Online (Sandbox Code Playgroud)

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

第二个:

#execute the following command
exec { 

     #this is our command name
    'apt-get update':
Run Code Online (Sandbox Code Playgroud)

创建资源的实例

第三个:

require => Exec['add php54 apt-repo']
Run Code Online (Sandbox Code Playgroud)

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