我正在testinghiera并在层次结构configuration上遇到困难。 我拥有的是非常简单的,不工作的部分是基于环境的hiera datadir文件的规范。 这是configuration文件( /etc/hiera.yaml )我在尝试
--- :backends: - yaml :logger: console :hierarchy: - "%{::environment}" :yaml: :datadir: /var/lib/hiera
现在,我有一个文件/var/lib/hiera/development.yaml
blah: meh
当我运行hiera时,它没有find文件或值
$ hiera -d blah DEBUG: Fri Oct 25 15:50:52 -0600 2013: Hiera YAML backend starting DEBUG: Fri Oct 25 15:50:52 -0600 2013: Looking up blah in YAML backend nil
我已validation此代理程序是否configuration了开发
$ sudo puppet agent --configprint environment development
现在让我certificatehiera能够find一些东西 ; 对hiera.yaml文件的更改:
:hierarchy: - development
现在,hierafind文件和价值
$ hiera -d blah DEBUG: Fri Oct 25 15:53:25 -0600 2013: Hiera YAML backend starting DEBUG: Fri Oct 25 15:53:25 -0600 2013: Looking up blah in YAML backend DEBUG: Fri Oct 25 15:53:25 -0600 2013: Looking for data source development DEBUG: Fri Oct 25 15:53:25 -0600 2013: Found blah in development meh
那么为什么不dynamic的环境configuration? 我从文档中得到了这一点。 请注意,我已经尝试通过sudo运行hiera命令,结果没有任何变化。
有很多方法可以提供地区事实 。 试试hiera -d blah environment=development 。