We need to execute bash script on several servers. To do it manually – bad idea. But we have puppet. Lets make it by puppet.
- Create bash script name.sh.
- Create new manifest and apply it to our servers:
class scriptexec {
file {
'my_bash_script':
ensure => 'file',
source => 'puppet:///modules/centos/name.sh',
path => '/tmp/name.sh',
owner => 'root',
group => 'root',
mode => '0744', # Use 0700 if it is sensitive
notify => Exec[‘run_my_script’],
}
exec {
'run_my_script':
command => '/tmp/name.sh',
refreshonly => true,
}
}
Everything works perfect.
Leave a Reply