鉴于以下configuration在我的Vagrantfile中:
puppet.facter = { 'variableOne' => 'one', 'variableTwo' => 'two' }
…以下是清单:
notify{ "Got here with ${variableOne} and ${variableTwo}":}
当我运行vagrant up (或vagrant provision如果已经),我看到输出中的以下行:
==> default: Notice: Got here with and
而当我join了对stream浪的命令的嘲弄之后,我在输出中也看到了这一点:
==> default: Running Puppet with default.pp... DEBUG ssh: Re-using SSH connection. INFO ssh: Execute: FACTER_variableOne='one' FACTER_variableTwo='two' puppet apply --verbose --debug --manifestdir /tmp/vagrant-puppet-3/manifests --detailed-exitcodes /tmp/vagrant-puppet-3/manifests/default.pp (sudo=true)
为什么variables没有被填充到清单中?
示例repo重现: https : //github.com/ericsmalling/vagrantpuppet
感谢我的一位同事@SebastianWeigand,我发现在variables名中使用cammel-case会导致问题。 在双方切换到“variableone”和“variabletwo”固定它。
也许你的通知是在一个命名空间内。 你可以尝试通过以下方式访问顶层范围中的factervariables:
notify{ "Got here with ${::variableOne} and ${::variableTwo}":}