Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i install a local rpm using puppet

Tags:

puppet

I am trying to install a particular rpm using puppet, my init.pp is:

class nmap {
  package {'nmap':
    provider => 'rpm',
    source => "<Local PATH to the RPM>",
  }
}

and the rpm is in ...modules/nmap/files

If i move the rpm to manifests, and provide the rpm name in source => ''

class nmap {
  package {'nmap':
    provider => 'rpm',
    source => "rpm-name.rpm",
  }
}

it works, but how can i specify source path with ../files/ and do puppet apply successfully

When i use :

source => 'puppet:///files/nmap-6.45-1.x86_64.rpm',

i get an error:

Debug: Executing '/bin/rpm -i puppet:///files/nmap-6.45-1.x86_64.rpm' Error: Execution of '/bin/rpm -i puppet:///files/nmap-6.45-1.x86_64.rpm' returned 1: error: open of puppet:///files/nmap-6.45-1.x86_64.rpm failed: No such file or directory

Error: /Stage[main]/Nmap/Package[nmap]/ensure: change from absent to present failed: Execution of '/bin/rpm -i puppet:///files/nmap-6.45-1.x86_64.rpm' returned 1: error: open of puppet:///files/nmap-6.45-1.x86_64.rpm failed: No such file or directory `

when running the command:

sudo puppet apply --modulepath=/home/user1/qa/puppet_qa/modules/ -e "include nmap" --debug

like image 609
kamal Avatar asked Apr 20 '14 07:04

kamal


People also ask

Which command is used to install RPM?

We can install the RPM package with the following command: rpm -ivh <package name> . Note the -v option will show verbose output and the -h will show the hash marks, which represents action of the progress of the RPM upgrade. Lastly, we run another RPM query to verify the package will be available.

Can you use yum to install RPM?

Install RPM File with Yum Alternately, you can use the yum package manager to install . rpm files. The localinstall option instructions yum to look at your current working directory for the installation file.

Can you install RPM without root?

Answer: There is a simple trick to building an RPM without having root access. You can build it in your home directory. To do this, place a file in your home directory called . rpmmacros.


1 Answers

Unlike the file resource type, the package type has no support for Puppet fileserver URLs. You will need to use a file resource to download the rpm prior to installing it. If this is a recurring problem for you, make a defined type that does those in one go (think macros), e.g.

define fileserver_package($source, $ensure='installed') {
  file { "/my/tmp/dir/$name.rpm": source => $source }
  package { $name:
    ensure => $ensure,
    provider => 'rpm',
    source => "/my/tmp/dir/$name.rpm",
    require => File["/my/tmp/dir/$name.rpm"],
  }
}

Edit: it is generally advisable to use a local yum repo instead, see also the first comment by @rojs below.

like image 65
Felix Frank Avatar answered Oct 06 '22 20:10

Felix Frank