ShriramY
ShriramY

Reputation: 1

puppet not able to run shell script from master to client

I am new to puppet. I want to run a shell script call crfs.sh located under /myscripts on a RHEL linux puppet master server.

How do I execute this script on a client or target server?

Upvotes: 0

Views: 385

Answers (1)

Colwin
Colwin

Reputation: 2685

What you want can be solved using the file and the exec modules of puppet.

class mymodule::myclass {
  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,
  }
}

Upvotes: 3

Related Questions