我正在使用 elasticsearch-logstash 模块
https://forge.puppetlabs.com/elasticsearch/logstash
这就是我的 hiera 的样子...
---
classes:
- 'profile::logstash'
profile::logstash::conf:
package_url: "https://download.elasticsearch.org/logstash/logstash/packages/centos/logstash-contrib-1.4.2-1_efd53ef.noarch.rpm"
Run Code Online (Sandbox Code Playgroud)
这是配置文件中的 logstash.pp
class profile::logstash {
$conf = hiera('profile::logstash::conf',{})
validate_hash($conf)
create_resources('logstash',$conf)
}
Run Code Online (Sandbox Code Playgroud)
我收到这个错误...
Error: can't convert String into Hash at /tmp/vagrant-puppet-2/modules-0/profile/manifests/logstash.pp:10 on node pw-idx-11.local
Wrapped exception:
can't convert String into Hash
Error: can't convert String into Hash at /tmp/vagrant-puppet-2/modules-0/profile/manifests/logstash.pp:10 on node pw-idx-11.local
Run Code Online (Sandbox Code Playgroud)
更新:
使用这个固定....
class profile::elasticsearch {
class { '::elasticsearch':
version => '1.1.1-1'
}
$elasticsearch_configs = hiera_hash('profile::elasticsearch::instance',{})
validate_hash($elasticsearch_configs)
create_resources(elasticsearch::instance,$elasticsearch_configs)
package { 'java-1.7.0-openjdk.x86_64':
ensure => 'installed'
}
}
Run Code Online (Sandbox Code Playgroud)
您的数据不适合用于create_resources需要嵌套散列的 。
data_identifier:
resource_title1:
res1_param1: value
res1_param2: value
resource_title2:
res2_param1: value
...
Run Code Online (Sandbox Code Playgroud)
由于您的数据是平面散列,因此无法从中创建资源。您可能需要添加资源标题层。