bash 选择流浪供应商

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7747328/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 00:57:24  来源:igfitidea点击:

Choosing a vagrant provisioner

bashconfiguration-managementchefpuppetvagrant

提问by Andrew Walker

Question

Can anyone explain why it would be better to choose the puppet or chef vagrant provisioners, rather than the shell provisioner?

谁能解释为什么选择 puppet 或 Chef vagrant 供应商而不是 shell 供应商会更好?

Background

背景

I'm in the process of getting started with Vagrant. One of the things I'm having trouble with is deciding which provisioner to use. So far, I've had some success using the shell provisioner, but it has been more work than I expected to get it to run reliably.

我正在开始使用 Vagrant。我遇到的问题之一是决定使用哪个供应商。到目前为止,我已经使用 shell 配置器取得了一些成功,但是要让它可靠地运行,它的工作量比我预期的要多。

At the moment, I'm not familar with ruby, puppet or chef, but I'm happy to learn any or all of them if I have to. My early experience playing with puppet and chef is that if someone else has a recipe that does exactly what you want, it works really well, but doing something non-standard means falling back coding up solution in ruby.

目前,我不熟悉 ruby​​、puppet 或厨师,但如果需要,我很乐意学习其中的任何一个或全部。我早期玩 Puppet 和 Chef 的经验是,如果其他人有一个完全符合您要求的食谱,它的效果非常好,但是做一些非标准的事情意味着退回用 ruby​​ 编码解决方案。

I'm aware of articles comparing puppet and chef, and I'm less worried about which of them to use, rather than knowing when and why I should use them at all.

我知道比较puppet 和 Chef的文章,我不太担心使用它们中的哪一个,而不是知道我应该何时以及为什么使用它们。

采纳答案by eshamow

Full disclosure: I'm a Puppet Labs employee. But I chose Puppet as a product over 2 years before joining them.

完全披露:我是 Puppet Labs 的员工。但在加入他们之前,我选择了 Puppet 作为产品超过 2 年。

I would recommend that you use Puppet or Chef over shell if your configurations are going to a) have any degree of complexity and b) going to change over time - or you expect your installation environment itself to change in a way that might alter the way your deployment performs. Your scripts may be very good, but ultimately, unless you are following terrific programming practices around them, testing and QA'ing them, etc they are going to fail at some point.

如果您的配置将 a) 具有任何程度的复杂性并且 b) 随着时间的推移而发生变化,我会建议您使用 Puppet 或 Chef over shell您的部署执行。您的脚本可能非常好,但最终,除非您遵循有关它们的出色编程实践、测试和 QA 等,否则它们将在某些时候失败。

There's an entire body of literate around DevOps discussing this notion, but it comes down to the principle of "technical debt" - we tend to do things the easy way now, and thus perceive them as simpler, at the cost of increasing complexity and difficulty later.

围绕 DevOps 有很多人在讨论这个概念,但归结为“技术债务”的原则——我们现在倾向于以简单的方式做事,因此认为它们更简单,代价是增加了复杂性和难度之后。

One of Puppet's strengths is its deterministic nature - the manifest you write must be able to be programmatically transformed by Puppet into a model of the server you are building. This is perceived by people as being more "difficult" but I would argue that the difficulty is lessened if you average it out along the curve of your technology's lifecycle. In other words, Puppet forces you to do your thinking now, but then deploy to scale with ease, rather than thinking later and re-engineering as you go. Pay in cash now, rather than by credit, with interest, later.

Puppet 的优势之一是其确定性——您编写的清单必须能够由 Puppet 以编程方式转换为您正在构建的服务器模型。人们认为这更“困难”,但我认为如果您沿着技术生命周期的曲线对其进行平均,则难度会降低。换句话说,Puppet 强迫您现在就做您的思考,然后轻松部署到规模,而不是稍后思考并在您进行时重新设计。现在用现金支付,而不是用信用卡支付,以后再付利息。

If you're purely pulling down other peoples' manifests, you're going to run into trouble at some point - although we would like it not to be so, working with Puppet today that's certainly the case, because they are writing them to address the general case, and not your particular system. Many general-purpose manifests become useful only when you reach a better understanding of Puppet.

如果你纯粹是拉下其他人的清单,你会在某个时候遇到麻烦——尽管我们不希望这样,今天与 Puppet 合作肯定是这种情况,因为他们正在写它们来解决一般情况,而不是您的特定系统。只有当您更好地了解 Puppet 时,许多通用清单才会变得有用。

So rather than start there, I'd work my way through the excellent Learning Puppetguide to start to grasp the basics. Puppet's learning curve is steep, but it levels off after a short while.

因此,与其从那里开始,我会通过优秀的学习木偶指南来开始掌握基础知识。Puppet 的学习曲线很陡峭,但不久后就会趋于平稳。

There are other reasons to use other provisioners or tools, but I'd surely argue that you are better with Puppet or Chef than trying to ensure that your shell scripts are doing exactly what you think they are supposed to do, for as long as you need to spawn new environments.

使用其他配置器或工具还有其他原因,但我肯定会争辩说,您最好使用 Puppet 或 Chef,而不是试图确保您的 shell 脚本完全按照您的想法执行,只要您需要产生新的环境。

回答by Noah

Ah, with the freedom of choice comes the complication of choosing what is right for you.

啊,随着选择的自由,选择适合你的东西变得复杂。

Chef Solo- Chef solo is most ideal if you're just getting started with chef or a chef server is simply too heavy for your situation. Chef solo allows you to embed all your cookbooks within your project as well, which is nice for projects which want to keep track of their cookbooks within the same repository. Chef solo runs standalone – it requires no chef server or any other server to talk to; it simply runs by itself on the VM.

Chef Solo- Chef Solo 是最理想的选择,如果您刚开始使用厨师或厨师服务器对于您的情况来说太重了。Chef solo 还允许您将所有食谱嵌入到您的项目中,这对于希望在同一存储库中跟踪其食谱的项目非常有用。Chef solo 独立运行——它不需要厨师服务器或任何其他服务器进行通信;它只是在 VM 上自行运行。

Chef Server- Chef server is useful for companies or individuals which manage many projects, since it allows you to share cookbooks across multiple projects. The cookbooks themselves are stored on the server, and the client downloads the cookbooks upon running.

Chef Server- Chef 服务器对于管理多个项目的公司或个人很有用,因为它允许您在多个项目之间共享食谱。说明书本身存储在服务器上,客户端在运行时下载说明书。

Puppet- The Puppet provisioner runs stand-alone Puppet manifests that are stored on the server and downloaded to the client VM when it is created. The provisioner does not require a Puppet server and runs on the VM itself.

Puppet- Puppet 供应器运行独立的 Puppet 清单,这些清单存储在服务器上并在创建时下载到客户端 VM。Provisioner 不需要 Puppet 服务器并在 VM 本身上运行。

Puppet Server- The Puppet Server provisioner connects to a Puppet server and configures your client VM using node configuration on that server.

Puppet Server- Puppet Server 供应商连接到 Puppet 服务器并使用该服务器上的节点配置来配置您的客户端 VM。

Other tools, shell scripts, etc. - Do you use something other than that which is built into Vagrant? Provisioners are simply subclasses of Vagrant::Provisioners::Base, meaning you can easily build your own, should the need arise.

其他工具、shell 脚本等 - 你是否使用 Vagrant 内置的以外的东西?Provisioners 只是 Vagrant::Provisioners::Base 的子类,这意味着您可以在需要时轻松构建自己的。

You can also check out the documentation, docs.vagrantup.com/v2

您还可以查看文档,docs.vagrantup.com/v2

回答by Mark

I would choose the Shell provisioner, then let the shell script clone your puppet/chef repository from github or bitbucket. The script can setup a ssh key to allow automated git clone. The benefits are most cloud providers support this as well so you can use the same script.This blog is explains git, puppet and vagrant well, one man and the cloud blog

我会选择 Shell 配置器,然后让 shell 脚本从 github 或 bitbucket 克隆您的 puppet/chef 存储库。该脚本可以设置 ssh 密钥以允许自动 git clone。好处是大多数云提供商也支持这一点,因此您可以使用相同的脚本。这个博客很好地解释了 git、puppet 和 vagrant,一个人和云博客