使用 Puppet 设置环境变量 [英] Set Environment Variables with Puppet
问题描述
我正在使用 vagrant 和 puppet 来为开发环境设置虚拟机.我想简单地在 .pp 文件中设置一些环境变量.为 64 位 Ubuntu 使用虚拟框和流浪基础框.
I am using vagrant with puppet to set up virtual machines for development environments. I would like to simply set a few environment variables in the .pp file. Using virtual box and a vagrant base box for Ubuntu 64 bit.
我目前有这个.
$bar = 'bar'
class foobar {
exec { 'foobar':
command => "export Foo=${bar}",
}
}
但是在配置时出现错误:找不到命令导出".
but when provisioning I get an error: Could not find command 'export'.
这似乎应该很简单,我是否缺少 exec 类型的某种要求或路径?我注意到文档中有一个环境选项来设置环境变量,我应该使用它吗?
This seems like it should be simple enough am I missing some sort of require or path for the exec type? I noticed in the documentation there is an environment option to set up environment variables, should I be using that?
推荐答案
如果你只需要 puppet run 中可用的变量,有什么问题:
If you only need the variables available in the puppet run, whats wrong with :
Exec { environment => [ "foo=$bar" ] }
?
这篇关于使用 Puppet 设置环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!