Ask Your Question

# Revision history [back]

The generate function executes a command and will return the output. As all functions the generate function runs on the master, so your program will also execute on the puppet master.

You have to provide a full qualified executable to the function (as a string; so use quotes) and possible arguments. You cannot run shell specifics (like pipes, output redirectons, etc)

e.g.

generate("/bin/echo", "-n", "Hallo Welt")


so if your command is more complicated, you either have to write a custom function or write a small shell script to execute the desired command and then call that shell script with generate. But be also aware that the puppet master (where the command will be executed) most likely runs as user puppet and not as root.