使用puppet安装依赖包

我是puppet新手,为了学习它的过程,我创build了Puppet MasterPuppet Slave安装程序,并configuration了一个mysql模块在Puppet client上安装mysql。 以下是清单文件。

 class mysql { package { ["mysql-server-5.5", "libaio1", "libdbd-mysql-perl", "libdbi-perl", "libhtml-template-perl", "libmysqlclient18", "mysql-client-5.5", "mysql-common", "mysql-server-core-5.5"]: ensure => present, allowcdrom => 'true', } } 

package资源包含mysql-server的所有依赖关系。 但是我得到了下面的错误。

 Building dependency tree... Reading state information... The following extra packages will be installed: mysql-common The following NEW packages will be installed: libmysqlclient18 mysql-common 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 738 kB of archives. After this operation, 3513 kB of additional disk space will be used. WARNING: The following packages cannot be authenticated! mysql-common libmysqlclient18 E: There are problems and -y was used without --force-yes Error: /Stage[main]/Mysql/Package[libmysqlclient18]/ensure: change from purged to present failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install libmysqlclient18' returned 100: Reading package lists... 

我也尝试添加install_options: "--force-yes"错误输出中提到的install_options: "--force-yes" ,但仍然遇到同样的问题。

任何帮助,将不胜感激。

你可以尝试下面的清单。 问题是你必须为apt-get添加-f--allow-unauthenticated选项来自动parsing依赖关系并安装它们。 一旦添加了这些标志,就不必将每个相关软件包添加到package资源中。

 class mysql { package { ["mysql-server-5.5"]: ensure => present, allowcdrom => 'true', install_options => ['--allow-unauthenticated', '-f'], } } 

从我看到你使用Ubuntu,因此Apt包pipe理器。 遇到的错误是由于安装了一个软件包,它找不到该软件包的公钥。

这可能是因为:

  • 您有一个不包含公钥的软件包源。
  • 在进行安装之前,您需要执行apt-get update来更新源代码。
  • 或者您需要手动导入密钥。

你有两个可能的解决scheme:

  • 导入密钥
  • 忽略丢失的关键
  • 或者在Puppet中使用以下configuration来忽略丢失的键。

    class {'::apt': disable_keys: true}

以上要求PppetLabs Apt模块。

我会检查第一个选项之前禁用键。 你没有给出足够的细节来得到一个确切的原因/解决scheme,但上面应该让你在正确的方向。