Ask Your Question
0

how to run ls command from puppet

asked 2015-10-23 15:21:34 -0600

drm509 gravatar image

updated 2015-10-23 15:23:53 -0600

How do I run the ls command from puppet? I tried the following:

class ... {
    exec { 'my_ls_cmd':
      command => "ls -sal",
      path => "/home/drm/",
    }
}

and the output is:

Error: Could not find command 'ls'
Error: /Stage[main]/Lumberjack_conf::Install/Exec[ls]/returns: change from notrun to 0 failed: Could not find command 'ls'
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2015-10-23 15:56:04 -0600

tsheriffk gravatar image

with what you have, you saying that the path to the "ls" command is /home/drm https://docs.puppetlabs.com/reference...

path The search path used for command execution. Commands must be fully qualified if no path is specified. Paths can be specified as an array or as a ‘:’ separated list.

i know you are just doing an example, by i think you'd want

class ... {
exec { 'my_ls_cmd':
  command => "ls -sal",
  cwd     => "/home/drm",
}

}

edit flag offensive delete link more

Comments

You may need both the path and cwd parameters to make it work. Exec doesn't load much of a path by default.

lavaman gravatar imagelavaman ( 2015-10-23 17:53:39 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-10-23 15:21:34 -0600

Seen: 446 times

Last updated: Oct 23 '15