Ask Your Question
1

How can I use package to install a local rpm at a specific location

asked 2013-11-29 19:13:38 -0500

ds gravatar image

updated 2014-03-07 13:06:20 -0500

Stefan gravatar image

Hi,

With rpm -ivh --prefix=/opt/mylocation my_package.rpm command I can have my_package installed under /opt/mylocation. How can I do the same with package using rpm provider?

package { "my_package":
      provider => rpm,
      source => "my_package.rpm",
      ensure => present,
      # and what else here ?
}

Thanks,

DS

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
3

answered 2014-03-07 02:17:19 -0500

alexkb gravatar image

updated 2014-03-07 02:19:39 -0500

You might be able to use the install_options value. So something like this might do:

package {
  "mypackage":
        provider => rpm,
        install_options => ['-ivh --prefix=/opt/mylocation'],
        ensure => installed,
}

Hope that helps.

edit flag offensive delete link more
0

answered 2014-06-10 11:14:49 -0500

supriya gravatar image

Hi when I used this I am getting error I downloaded rpm and placed in */etc/puppetlabs/puppet/environments/development/modules/java_rpm/files/jdk-7u25-linux-x64.rpm* and I have a directory /u01/app/oracle/product/jdk1.7.025 but it is throwing me error. Error: Execution of '/bin/rpm -i "-ivh --prefix=/u01/app/oracle/product/jdk1.7.025" /etc/puppetlabs/puppet/environments/development/modules/javarpm/files/jdk-7u25-linux-x64.rpm' returned 1: error: open of -ivh\ --prefix=/u01/app/oracle/product/jdk1.7.025 failed: No such file or directory

Error: /Stage[main]/Javarpm/Package[jdk-7u25-linux-x64]/ensure: change from absent to present failed: Execution of '/bin/rpm -i "-ivh --prefix=/u01/app/oracle/product/jdk1.7.025" /etc/puppetlabs/puppet/environments/development/modules/javarpm/files/jdk-7u25-linux-x64.rpm' returned 1: error: open of -ivh\ --prefix=/u01/app/oracle/product/jdk1.7.025 failed: No such file or directoryError: Execution of '/bin/rpm -i "-ivh --prefix=/u01/app/oracle/product/jdk1.7.025" /etc/puppetlabs/puppet/environments/development/modules/javarpm/files/jdk-7u25-linux-x64.rpm' returned 1: error: open of -ivh\ --prefix=/u01/app/oracle/product/jdk1.7.0_25 failed: No such file or directory

Error: /Stage[main]/Javarpm/Package[jdk-7u25-linux-x64]/ensure: change from absent to present failed: Execution of '/bin/rpm -i "-ivh --prefix=/u01/app/oracle/product/jdk1.7.025" /etc/puppetlabs/puppet/environments/development/modules/javarpm/files/jdk-7u25-linux-x64.rpm' returned 1: error: open of -ivh\ --prefix=/u01/app/oracle/product/jdk1.7.025 failed: No such file or directory

edit flag offensive delete link more

Comments

class java_rpm::install { $version = 'jdk-7u25-linux-x64.rpm' package { $version: provider => rpm, #exec {"$version": install_options => ['-vh','--prefix=/u01/app/oracle/product/java'], #owner => oracle, #group => oinstall, #mode => 0755, # command => "rpm -ivh --prefix=/u01/app/oracle/product/java jdk-7u25-linux-x64. rpm", source => "/etc/puppetlabs/puppet/environments/development/modules/java_rpm/files/jdk-7u25-linux-x64 This is the wright answer

supriya gravatar imagesupriya ( 2014-06-11 08:27:20 -0500 )edit

No, that's not the right answer - it's a commented out exec. I'm seeing the same error as above because the Puppet is putting double quotes around the install_options. Is very frustrating and makes me think nobody tested this functionality.

esmalling gravatar imageesmalling ( 2016-03-01 13:51:11 -0500 )edit
0

answered 2016-03-02 06:28:03 -0500

esmalling gravatar image

This is working for me:

package {
  "mypackage":
        provider => rpm,
        install_options => {'--prefix' => '/opt/mylocation'},
        ensure => installed,
}

Note the use of hash notation in the install_options value.

I've found that if you use a string or array with one string as the install_options value that the command will be malformed, having double quotes surrounding it. If, however, you use the hash notation, it seems to work fine.

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: 2013-11-29 19:13:38 -0500

Seen: 8,758 times

Last updated: Mar 02 '16