我想通过使用带有 puppet 的命令 zypper 来安装多个包。我创建了自己的存储库并在其中转储了一些 bacula 包。我的清单如下:
#cat manifests/init.pp
class bacula()
{
$baculas = [ "bacula-dir", "bacula-fd", "bacula-bat", "bacula-bconsole", "bacula- catalog-postgresql", "bacula-libs", "bacula-postgresql", "bacula-sd", "bacula-sql", "bacula-tools", "bacula-updatedb" ]
package { $baculas: ensure => "installed" }
exec { 'install_bacula':
provider => shell,
path => [ "/bin/", "/usr/bin", "/sbin" ],
command => "/usr/bin/zypper -n in $baculas;",
logoutput => on_failure,
}
}
虽然软件包安装得很好,但输出中有错误。似乎包的名称被连接起来,并且 puppet 由于无法找到如此冗长的包名称而返回错误。下面的输出:
# puppet agent --test
info: Caching catalog for otoyas
info: Applying configuration version '1418720157'
notice: /Stage[main]/Bacula/Package[bacula-dir]/ensure: created
notice: /Stage[main]/Bacula/Package[bacula-sd]/ensure: created
notice: /Stage[main]/Bacula/Package[bacula-fd]/ensure: created
notice: /Stage[main]/Bacula/Exec[install_bacula]/returns: Loading repository data...
notice: /Stage[main]/Bacula/Exec[install_bacula]/returns: Reading installed packages...
notice: /Stage[main]/Bacula/Exec[install_bacula]/returns: 'bacula-dirbacula-fdbacula-batbacula-bconsolebacula-catalog-postgresqlbacula-libsbacula-postgresqlbacula-sdbacula-sqlbacula-toolsbacula-updatedb' not found in package names. Trying capabilities.
notice: /Stage[main]/Bacula/Exec[install_bacula]/returns: No provider of 'bacula-dirbacula-fdbacula-batbacula-bconsolebacula-catalog-postgresqlbacula-libsbacula-postgresqlbacula-sdbacula-sqlbacula-toolsbacula-updatedb' found.
err: /Stage[main]/Bacula/Exec[install_bacula]/returns: change from notrun to 0 failed: /usr/bin/zypper -n in bacula-dirbacula-fdbacula-batbacula-bconsolebacula-catalog-postgresqlbacula-libsbacula-postgresqlbacula-sdbacula-sqlbacula-toolsbacula-updatedb; returned 104 instead of one of [0] at /etc/puppet/modules/bacula/manifests/init.pp:12
notice: /Stage[main]/Bacula/Package[bacula-bat]/ensure: created
notice: /Stage[main]/Bacula/Package[bacula-updatedb]/ensure: created
notice: /Stage[main]/Vsftpd/Exec[install_vsftpd]/returns: executed successfully
notice: /Stage[main]/Bacula/Package[bacula-tools]/ensure: created
notice: /Stage[main]/Bacula/Package[bacula-postgresql]/ensure: created
notice: Finished catalog run in 6.28 seconds
我该如何解决?如果有更好的方法来执行此任务,我愿意接受建议,因为我是 puppet 的新手。
谢谢。