[puppet]如何设置全局exec path

在编写puppet模块中,常常需要用的exec resource,而在每个exec block里都需要添加一个path就太让人boring了,而且某些命令不一定是在/usr/bin,也可能是在/sbin,也可能是在其他目录。

解决办法就是设置一个全局的PATH路径:

# put this somewhere global, like site.pp
Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }

# uses the globally specified path
exec { "make_foo_state":
    command => "mkdir -p /tmp/foo/state",
}

# overrides the global path for this command
exec { "my_local_command":
    command => "my_special_local_command",
    path    => "/usr/local/sbin/",
}
posted @ 2012-11-23 10:57  牛皮糖NewPtone  阅读(1020)  评论(0编辑  收藏  举报