有人可以告诉我为什么这不起作用吗?这段代码在Ubuntu服务器上工作正常,但在CentOS上崩溃了。我正在运行Puppet版本3.7.2
。
node default {
package { 'httpd':
ensure => 'absent'
}
package { 'nginx':
ensure => 'installed',
require => Package['httpd'],
}
}
我收到此错误:
Error: Execution of '/bin/yum -d 0 -e 0 -y list nginx' returned 1: Error: No matching Packages to list
Error: /Stage[main]/Main/Node[default]/Package[nginx]/ensure: change from absent to present failed: Execution of '/bin/yum -d 0 -e 0 -y list nginx' returned 1: Error: No matching Packages to list
答案 0 :(得分:5)
nginx不在默认的CentOS仓库中;它需要epel
。在安装软件包之前,您需要epel-release
:
package { 'epel-release':
ensure => 'installed',
}
package { 'nginx':
ensure => 'installed',
require => [Package['httpd'], Package['epel-release']],
}
顺便说一下,你的nginx安装是否特别要求在安装之前缺少httpd?您应该能够删除httpd元参数依赖项。