What is the best way to run a script block in puppet exec? -
executing simple commands pretty straight forward. best way write, if command script block instead of one-liner, e.g.:
exec { command => 'for in vars echo $i more-statements done'; }
a couple of ways can think of are:
- write script block proper escaping work (not tidy option)
- write script block in file.sh , execute in command
are there other options?
if want write script block, in way described:
exec { 'multi line exec': command => "source foo.sh echo 'bar' touch /var/tmp/baz ', path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', provider => 'shell', }
generally advice against doing this, because becomes little complicated escaping things (and difference between puppet usage of $
variables , actual shell $
variables...
depending on complexity of script, , if want run tools other puppet, i'd create file-on-disk file
type, have exec run scripts.
or better, split shells parts separate exec resources dependancies , unless parameters.
Comments
Post a Comment