没有 APT 推荐使用 puppet

Zor*_*che 8 debian puppet apt

我使用 puppet 来管理工作中的一堆 Debian 服务器,如果这包括安装软件包的话。我在多个系统上安装的一个软件包是 nmap,它用于验证防火墙规则设置是否正确。在 Debian 7.0 上,如果你启用了 APT::Install-Recommends,你会得到一堆废话和 nmap(见下文)。

我不希望包含启用推荐的所有安装 nmap 的废话。一种解决方案是使用APT::Install-Recommends "0";. 但我不想让它成为默认值。大多数时候我想要推荐包括在内。推荐的包大多都很好,我没有得到很多我不需要的东西。但是有一些包裹带来了我不想要/不需要的东西。

  package { 'nmap':
    ensure => installed,
    require => Class['apt'],
  }
Run Code Online (Sandbox Code Playgroud)

在使用“apt”软件包提供程序时,是否有任何方法可以控制是否通过 puppet 安装了推荐? 我不想与 aptitude 提供者混为一谈,因为 apt 和 aptitude 彼此并不完全兼容。

有推荐

root@fw-01:~# apt-get install nmap
Reading package lists... Done
Building dependency tree       
Reading state information... Done
... 
The following NEW packages will be installed:
  fonts-droid fonts-liberation ghostscript gnuplot gnuplot-nox groff gsfonts
  imagemagick imagemagick-common libblas3 libblas3gf libcroco3 libcupsimage2
  libdjvulibre-text libdjvulibre21 libexiv2-12 libgfortran3 libgs9
  libgs9-common libijs-0.35 libilmbase6 libjbig2dec0 liblcms1 liblcms2-2
  liblensfun-data litesting firewall blensfun0 liblinear-tools liblinear1 liblqr-1-0
  libmagickcore5 libmagickcore5-extra libmagickwand5 libnetpbm10 libopenexr6
  libpaper-utils libpaper1 librsvg2-2 librsvg2-common libsvm-tools libwmf0.2-7
  netpbm nmap poppler-data psutils ufraw-batch
0 upgraded, 45 newly installed, 0 to remove and 0 not upgraded.
Need to get 32.0 MB of archives.
After this operation, 93.8 MB of additional disk space will be used.
Do you want to continue [Y/n]? 
Run Code Online (Sandbox Code Playgroud)

没有推荐

root@fw-01:~# apt-get --no-install-recommends install nmap
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libblas3 libblas3gf libgfortran3 liblinear1
Suggested packages:
  liblinear-dev
Recommended packages:
  liblinear-tools
The following NEW packages will be installed:
  libblas3 libblas3gf libgfortran3 liblinear1 nmap
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,405 kB of archives.
After this operation, 17.4 MB of additional disk space will be used.
Do you want to continue [Y/n]?
Run Code Online (Sandbox Code Playgroud)

小智 11

现在可以通过 Puppet 'package' 类型中的“install_options”设置来实现:http : //docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options

例如:

package { 'nmap':
  ensure          => installed,
  install_options => ['--no-install-recommends'],
}
Run Code Online (Sandbox Code Playgroud)

以上确保将“--no-install-recommends”选项传递给apt-get,它会跳过仅为此安装推荐的软件包:http : //manpages.ubuntu.com/manpages/precise/man8/apt-get .8.html