Question

Hi I've an exe file (Ex: test.exe) and it is expecting some parameters like param1 and param2. How can I run this exe file using puppet script.

Ex: test.exe param1 param2

Was it helpful?

Solution

The command execution using exec in puppet is what you need here. I am pasting example below from Puppet documentation - and as you can see the command itself contains the parameters to be passed. In this case tar command is passed options and then filename. If your parameters are variables - you can pass them as you would ($varName I guess)

exec { "tar -xf /Volumes/nfs02/important.tar":
  cwd     => "/var/tmp",
  creates => "/var/tmp/myfile",
  path    => ["/usr/bin", "/usr/sbin"]
}

So to execute the some command.exe with param1 and param2 would be:

exec {"command.exe param1 param2"
    cwd  => "C:\text"
}

On what other options you can tweak, check attributes for exec command and to understand more on behavior of execution on various environments (Shell/ windows etc.) check providers for exec

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top