我正在尝试通过Puppet安装jdk rpm。我尝试了许多清单,但没有一个工作。
此刻,我已经像这样表现出来了
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',
}
}
我的错误
[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 ~]#
答案 0 :(得分:0)
似乎我在这里错过了基本观点。 package
属性的来源始终是指Puppet-agent上的地址。即在安装之前将文件复制到远程机器的位置。
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"],
}
}
将在Puppet-agent上安装rpm。