Given a module like:
mymodule/
|-- data
| `-- data.yaml
|-- hiera.yaml
|-- manifests
| `-- init.pp
`-- metadata.json
mymodule/hiera.yaml
---
version: 4
datadir: data
#data_hash: yaml_data
hierarchy:
- name: "data"
backend: yaml
path: "data/data.yaml"
- name: "common"
backend: yaml
mymodule/manifests/init.pp
class mymodule {
$var = lookup('mymodule::var')
notify {"var: ${var}":}
}
mymodule/data/data.yaml
---
mymodule::var: 'var value from mymodule/data/data.yaml'
mymodule/metadata.json
{
"name": "example-mymodule",
"version": "0.0.1",
"author": "Pat",
"license": "Apache-2.0",
"summary": "A module for a thing",
"source": "https://github.com/examplecorp/examplecorp-mymodule",
"project_page": "https://forge.puppetlabs.com/examplecorp/mymodule",
"issues_url": "https://github.com/examplecorp/examplecorp-mymodule/issues",
"tags": ["things", "stuff"],
"operatingsystem_support": [
{
"operatingsystem":"RedHat",
"operatingsystemrelease":[ "5.0", "6.0" ]
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [ "12.04", "10.04" ]
}
],
"dependencies": [
{ "name": "puppetlabs/stdlib", "version_requirement": ">= 3.2.0 < 5.0.0" }
],
"data_provider": "hiera"
}
----------
root@puppet-pil00:/etc/puppetlabs# /opt/puppetlabs/bin/puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Function lookup() did not find a value for the name 'mymodule::var' on node puppet-pil00.msc.es
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
why lookup() can't find mymodule::var variable in data.yaml?
↧