所以我正在尝试使用 hiera 来更改我在流浪者盒子上设置 git user.name 和 user.email 的方式。
我在我的默认.pp中有这个
git::config { 'user.name':
value => hiera("github_username"),
}
git::config { 'user.email':
value => hiera("github_email"),
}
在流浪者文件中,我有这个(在木偶选项中):
puppet.options = "--hiera_config/vagrant/hieradata/hiera.yaml"
这似乎加载正确。我在那个文件中是这样的:
---
:backends:
- yaml
:hierarchy:
- defaults
- "%{clientcert}"
- "%{environment}"
- global
- company
:yaml:
:datadir:/vagrant/hieradata
现在在公司内部.yaml,我有:
github_username: 'antonio'
github_email: 'antonio@mail.com'
当我做流浪规定时,我收到以下错误消息:
==> debian_dev: Error: Error from DataBinding 'hiera' while looking up 'apache::apache_name': can't convert Symbol into Integer on node debian.dev
==> debian_dev: Wrapped exception:
==> debian_dev: can't convert Symbol into Integer
==> debian_dev: Wrapped exception:
==> debian_dev: can't convert Symbol into Integer
==> debian_dev: Error: Error from DataBinding 'hiera' while looking up 'apache::apache_name': can't convert Symbol into Integer on node debian.dev
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
我正在使用 apache 模块,但即使在默认的 hiera.yaml(/etc/hiera.yaml 上的那个)中,也没有 apache::apache_name 的定义。
如果我不传入傀儡的选项,只是抱怨找不到 hiera.yaml 并且它将使用默认选项。
关于如何解决此问题的任何想法或建议?
谢谢!
PS:我正在运行带有Vagrant 7的Windows 1.6.5和puppet 3.7.1
更新您的 hiera.yaml 文件,以便 datadir 中有一个空格:
:yaml:
:datadir: /vagrant/hieradata
为了帮助调试,我建议在你的Vagrantfile中添加详细和调试选项:
config.vm.provision "puppet" do |puppet|
puppet.options = "--verbose --debug"
end
以下是您应该看到的错误的 datadir 值:
$ vagrant provision
==> other: Running provisioner: puppet...
==> other: Running Puppet with default.pp...
==> other: stdin: is not a tty
==> other: Notice: Scope(Node[default]): -----
==> other: Debug: hiera(): Hiera YAML backend starting
==> other: Debug: hiera(): Looking up github_username in YAML backend
==> other: Debug: hiera(): Looking for data source defaults
==> other: Debug: hiera(): Found github_username in defaults
以下是更新数据目录后应看到的内容:
$ vagrant provision
==> other: Running provisioner: puppet...
==> other: Running Puppet with default.pp...
==> other: stdin: is not a tty
==> other: Notice: Scope(Node[default]): -----
==> other: Debug: hiera(): Hiera YAML backend starting
==> other: Debug: hiera(): Looking up github_username in YAML backend
==> other: Debug: hiera(): Looking for data source defaults
==> other: Debug: hiera(): Found github_username in defaults
这也应该有助于解释在 hiera 进行查找时如何找到值。