Ask Your Question
0

how to deploy bash scripts using puppet

asked 2014-09-26 16:11:59 -0600

umairch gravatar image

I want to ship a bash script along with some files to an agent managed by puppet master, the script will install some custom plugins, can puppet move/scp those files and bash script to the target nodes and then execute the script ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-09-27 10:21:49 -0600

llowder gravatar image

You'll want to use a file resource to place the files and then an exec to run the file.

Something like:

class mymodule::myklass {
  file {
    'my_bash_script':
      ensure => 'file',
      source => 'puppet:///modules/mymodule/my_bash_script.sh',
      path => '/usr/local/bin/my_bash_script.sh',
      owner => 'root'
      group => 'root'
      mode  => '0744', # Use 0700 if it is sensitive
      notify => Exec['run_my_script'],
  }
  exec {
    'run_my_script':
     command => '/usr/local/bin/my_bash_script.sh',
     refreshonly => true,
  }
}
edit flag offensive delete link more

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: 2014-09-26 16:11:59 -0600

Seen: 12,746 times

Last updated: Sep 27 '14