简体   繁体   English

使用Puppet时,如何为共享环境资源(程序包,配置等)构建Puppet配置?

[英]How should I structure my puppet configurations for shared environment resources (packages, configurations, etc) when using Puppet?

So I'm setting up puppet for a project I'm working on and I wanted to know what the best way to share resources between environments is. 因此,我正在为一个正在研究的项目设置人偶,我想知道在环境之间共享资源的最佳方法是什么。 The problem is that I have a number of common packages that I want installed between a few different environments. 问题是我有一些常见的软件包,需要在几个不同的环境之间安装。

I read up on puppets support for environments and it looked like all you can do is specify the module path and the manifest. 我阅读了有关对环境的伪造的支持,看来您所能做的就是指定模块路径和清单。 If that's the case, then what is even the point of environments? 如果是这样,那么环境的意义何在?

What I'm thinking about doing is just having a shared module path that has a module with the shared packages to install and then importing that into each environment's site manifest, but that just seems like a hacky way of doing it especially when modules are supposed to be stand alone. 我正在考虑的只是共享模块路径,该路径具有要安装的共享软件包的模块,然后将其导入每个环境的站点清单中,但这似乎是一种很麻烦的方式,尤其是在应该使用模块的情况下独自一人。

Is there a better way to implement this? 有没有更好的方法来实现这一目标? Am I missing something? 我想念什么吗?

Thanks. 谢谢。

You may use node to configure different environment: 您可以使用node配置不同的环境:

# /etc/puppetlabs/puppet/manifests/site.pp
node 'dev' {
  include common
  include apache
  include squid
}
node 'prod' {
  include common
  include mysql
}

Here's a reference: http://docs.puppetlabs.com/puppet/2.7/reference/lang_node_definitions.html 这是参考: http : //docs.puppetlabs.com/puppet/2.7/reference/lang_node_definitions.html

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

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