A collection of task oriented solutions in Puppet


Set a default $PATH for all execs


You've had enough of specifying a complete 'path =>' on each exec and you want a more global solution


class global_exec_path {

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

  # alternative, compact, format
  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/',



Adding a path to every exec is annoying, easy to forget and leads to unneeded duplication. By placing the Exec shown above in a global location (like your site.pp file) all execs will use that path by default, while still allowing you to add extra directories to the path where needed.