puppet无法从主服务器到客户端运行shell脚本

时间:2017-06-05 10:08:53

标签: puppet

我是傀儡新手。我想在RHEL linux puppet主服务器上运行位于 RelativeLayout layout = (RelativeLayout) findViewById(R.id.toplinear); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); params.addRule(RelativeLayout.CENTER_HORIZONTAL); params.addRule(RelativeLayout.CENTER_VERTICAL); myImage.setLayoutParams(params); layout.addView(myImage, params); 下的shell脚本调用crfs.sh

如何在客户端或目标服务器上执行此脚本?

1 个答案:

答案 0 :(得分:3)

您可以使用木偶的fileexec模块解决您想要的问题。

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,
  }
}