Danial
Danial

Reputation: 703

Installing Jenkins by Puppet

I am trying to automate the Jenkins installation on a Vegrant VM . Here is the Puppet file I wrote for this purpose :

class jenkins {
  exec {
    'jenkins download':
    command => '/usr/bin/wget -q -O - http://pkg.jenkins-ci.org/debian-stable/binary/jenkins_1.565.1_all.deb',
    cwd => '/tmp',
    creates => '/tmp/jenkins_1.565.1_all.deb',
    timeout => 0
  }

  package { 'jenkins install':
#provider => dpkg,
ensure => installed,
source => "/tmp/jenkins_1.565.1_all.deb",
require => [Package['memcached'], Package['openjdk-7-jdk']]
  }



  service {
    'jenkins':
    enable => true,
    ensure => running,
    hasrestart => true,
    hasstatus => true,
    require => Package['jenkins install']
  }
}

But I receive error during the process:

    err: /Stage[main]/Jenkins/Package[jenkins install]/ensure: change from purged to present              failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install jenkins     install' returned 100: Reading package lists...
==> default: Building dependency tree...
==> default: Reading state information...
==> default: E: Unable to locate package jenkins install
==> default: 

Anybody can help to eliminate this error?

Upvotes: 0

Views: 530

Answers (1)

Felix Frank
Felix Frank

Reputation: 8223

Your basic problem is that the package resource is named jenkins install, so Pupet tries to manage a package of that name. This is wrong: The package is named jenkins.

You also need to set the provider to dpkg so that Puppet will not try and use apt to install the package.

package {
    'jenkins':
         ensure   => 'installed',
         provider => 'dpkg',
         source   => ...
}

Upvotes: 1

Related Questions