在编写puppet模块中,常常需要用的exec resource,而在每个exec block里都需要添加一个path就太让人boring了,而且某些命令不一定是在/usr/bin,也可能是在/sbin,也可能是在其他目录。
解决办法就是设置一个全局的PATH路径:
# put this somewhere global, like site.ppExec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }# uses the globally specified pathexec { "make_foo_state": command => "mkdir -p /tmp/foo/state",}# overrides the global path for this commandexec { "my_local_command": command => "my_special_local_command", path => "/usr/local/sbin/",}