Ask Your Question

Unable to make batch file prompt for input when invoked through puppet exec

asked 2014-11-20 15:01:40 -0600

puppet-user gravatar image

I have a simple batch script which should prompt users for 2 inputs. The batch file works fine on it's own but when I invoke it through puppet exec, the execution does not wait for user input. It simply passes it.

Batch file is invoked as below

file { 'C:/mydir/myfile.bat':
ensure => 'file',
source_permissions => 'ignore',
source => 'puppet:///modules/mymodule/myfile.bat',
 exec { 'execbatch':
 command => "C:/mydir/myfile.bat",

Do I have to pass any additional parameters for the batch file to become interactive?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-11-24 19:49:44 -0600

Stefan gravatar image

Puppet is not designed to run interactivly and therefore puppet takes care that your script will not block for user input. Technically puppet redirects STDIN (which is your terminal/keyboard by default) to read from from the pseudo file NUL (or /dev/null on linux)

So to answer your question

Do I have to pass any additional parameters for the batch file to become interactive?

no, because it is simply not possible.

A script that you specify in an exec resource should be a tool to migrate to a specific desired state (which puppet should be able to verify), so if you could explain a bit more what you are trying to accomplish, then we might find a better way to do it (like an answer file or something if it is an installation script)

edit flag offensive delete link more


Thank you for your answer. I'm trying to install a software package on systems automatically but the installation requires few user inputs. For now I have made it work by getting all the required variables through a batch script and passing it on to site.pp.

puppet-user gravatar imagepuppet-user ( 2014-11-26 16:14:23 -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


Asked: 2014-11-20 15:01:40 -0600

Seen: 610 times

Last updated: Nov 24 '14