简体   繁体   English

Chef在文本文件中包含软件包列表

[英]Chef include list of packages in text file

I'm new to chef and planning for disaster recovery plan such that will be having all my configuration files, list of packages installed on system in chef cookbooks. 我是厨师新手,正在计划灾难恢复计划,以便将所有配置文件,安装在厨师食谱中的软件包列表安装在系统上。 I wondering how could i mention a text file in recipe for the package installation. 我想知道如何在安装包的配方中提到一个文本文件。

I have taken list of packages with 我已经拿了包装清单

dpkg --get-selections > packages.txt.

I would like chef to read a package from that list one by one and install it. 我希望厨师从清单中逐个读取一个软件包并安装它。 Would be great if someone can guide me on this. 如果有人可以在这方面指导我,那就太好了。

Thanks, Swaroop. 谢谢,斯沃普。

Blueprint could help you for your task. 蓝图可以帮助您完成任务。 It inspects the system and generates a chef cookbook out of it. 它检查系统并从中生成厨师食谱。

Disclaimer: I haven't tried it, yet. 免责声明:我还没有尝试过。 But it looks very interesting. 但这看起来非常有趣。

I am not aware of a way to read a file from a cookbook. 我不知道从食谱读取文件的方法。 But you can install a number of packages with the following code in a recipe: 但是您可以在配方中使用以下代码安装许多软件包:

%w{
package-1
package-2
}.each do |pkg|
  package pkg
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM