0

I am trying to install jdk rpm via Puppet. I have tried lot of manifests but none of them working.

At this moment, I have manifest like this

class java {

  #file {' Java 8 rpm file':
  #source =>  'puppet:///modules/java/jdk-8u161-linux-x64.rpm',
  #}


package { 'jdk-8u161-linux-x64.rpm':
  ensure   => 'present',
  provider => 'rpm',
  source   =>  '/etc/puppetlabs/code/environments/production/modules/java/jdk-8u161-linux-x64.rpm',
}

}

And I am getting below error

[root@sahasraarchi ~]# puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for sahasraarchi.devmac.com
Info: Applying configuration version '1517758835'
Error: Execution of '/usr/bin/rpm -i /etc/puppetlabs/code/environments/production/modules/java/jdk-8u161-linux-x64.rpm' returned 1: error: open of /etc/puppetlabs/code/environments/production/modules/java/jdk-8u161-linux-x64.rpm failed: No such file or directory
Error: /Stage[main]/Java/Package[jdk-8u161-linux-x64.rpm]/ensure: change from absent to present failed: Execution of '/usr/bin/rpm -i /etc/puppetlabs/code/environments/production/modules/java/jdk-8u161-linux-x64.rpm' returned 1: error: open of /etc/puppetlabs/code/environments/production/modules/java/jdk-8u161-linux-x64.rpm failed: No such file or directory
Notice: Applied catalog in 2.01 seconds
[root@sahasraarchi ~]#
Raja G
  • 5,973
  • 14
  • 49
  • 82

1 Answers1

0

Seems I have missed basic point here. Source at package attribute is always referring the address on Puppet-agent. i.e to where file copying to remote machine before its getting installed.

class java {

  file {' /tmp/jdk-8u161-linux-x64.rpm':
  source =>  'puppet:///modules/java/jdk-8u161-linux-x64.rpm',
  }


package { 'jdk-8u161-linux-x64.rpm':
  ensure   => 'present',
  provider => 'rpm',
  source   =>  '/tmp/jdk-8u161-linux-x64.rpm',
  require => File["/tmp/jdk-8u161-linux-x64.rpm"],
}

}

Will install the rpm at Puppet-agent.

Raja G
  • 5,973
  • 14
  • 49
  • 82