Ask Your Question
0

Puppet install RPM and run script

asked 2016-02-24 21:25:45 -0500

Teesha gravatar image

I have an RPM that installs a shell script. Puppet needs to access this RPM, retrieve the shell script packaged in the RPM and execute it. How do I do that?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-02-26 23:57:56 -0500

If you mean you simply want Puppet to install the RPM, then execute the script that the RPM deploys, you could do this:

package { 'mypackage':
  ensure => installed,
}
exec { '/path/to/myscript':
  onlyif  => ...,
  require => Package['mypackage'],
}

Most people, though, will save that script in their Puppet code as an ERB template and let Puppet fully manage that file.

package { 'mypackage':
  ensure => installed,
}
file { '/path/to/myscript':
  ensure  => file,
  content => template('mymodule/myscript'),
  require => Package['mypackage'],
}
exec { '/path/to/myscript':
  onlyif  => ...,
  require => File['/path/to/myscript'],
}

Now maybe you're concerned that a new version of the RPM will change that file and you won't know this, because Puppet will be overwriting with an old copy.

Well, that's why we recommend full continuous delivery, the CI/CD framework. If that happens, you should have tests to pick it up in the development stage.

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: 2016-02-24 21:25:45 -0500

Seen: 144 times

Last updated: Feb 26 '16