Ask Your Question

rpm command in puppet

asked 2015-04-24 06:31:30 -0600

Chutki gravatar image


I am working on mcafee installation. I downloaded zip file from someother tool and keep it in modules/files directory. In that zip file there is a scipt called mcafee_insatall. this script will install mcafee rpm's. I am converting that into puppet

Below is the manifests

exec {'install_sw':
    cwd     => 'mcafee/puppet/test/downloaded',
    command => ./ -i ",
    onlyif  => "/usr/bin/test -e /mcafee/puppet/test/downloaded"

manifests working but if rerun, it failed with below error

change from notrun to 0 failed: ./ -i  returned 1 instead of one of [0]

because the rpm already installed , so "exec" resources not installing again. so I should change my onlyif like if rmp -qa MF* already exist the command should run else it should not execute

is there any option in puppet

I can't use pacakge resource because that mcafee package is not available in linux repo. I should go with install script only.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-04-24 08:33:55 -0600

JohnsonEarls gravatar image

updated 2015-04-24 08:37:54 -0600

If you know the names of all the rpms to be installed, and that's all the script does, then you can use the package resource:

package { 'MFfoobar':
    provider => 'rpm' ,
    ensure => 'installed' ,
    source => '/.../.../MFfoobar-version-release.arch.rpm'

If the install script does other things, then you can use the unless parameter to exec:

exec {'install_sw':
    cwd     => 'mcafee/puppet/test/downloaded',
    command => "./ -i ",
    unless => "rpm -q MFfoobar-version-release"
edit flag offensive delete link more


Thanks. It worked

Chutki gravatar imageChutki ( 2015-04-24 14:37:15 -0600 )edit

answered 2015-06-10 18:14:32 -0600

chanti gravatar image

Thank you very much! :)

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


Asked: 2015-04-24 06:31:30 -0600

Seen: 1,447 times

Last updated: Apr 24 '15