I have module called mdwcfg which is used for hiera configuration:
mdwcfg/hiera.yaml:
---
version: 5
defaults:
datadir: data
data_hash: yaml_data
hierarchy:
- name: "wld-pil-03"
path: "wld-pil-03.yaml"
- name: "wld-pil-04"
path: "wld-pil-04.yaml"
- name: "jdk"
path: "jdk.yaml"
- name: "common"
path: "common.yaml"
mdwcfg/data/wld-pil-04.yaml:
---
domain_env: 'pil'
domain_number: '04'
mdwcfg::domain_env: &domain_env 'pil'
mdwcfg::domain_number: &domain_number '04'
mdwcfg::domain_name: &domain_name "wld-%{mdwcfg::domain_env}-%{mdwcfg::domain_number}"
and I create a test file /tmp/kk.pp
include mdwcfg
$a = lookup('mdwcfg::domain_name')
notify{"a: ${a}":}
puppet can't interpolate the variable mdwcfg:domain_name
/opt/puppetlabs/bin/puppet apply /tmp/kk.pp --modulepath=/etc/puppetlabs/code/environments/production/modules/ --debug
....
Debug: Facter: resolving Xen facts.
Debug: Evicting cache entry for environment 'production'
Debug: Caching environment 'production' (ttl = 0 sec)
Debug: importing '/etc/puppetlabs/code/environments/production/modules/mdwcfg/manifests/init.pp' in environment production
Debug: Automatically imported mdwcfg from mdwcfg into production
Warning: Defining "data_provider": "hiera" in metadata.json is deprecated. It is ignored since a 'hiera.yaml' with version >= 5 is present
(in /etc/puppetlabs/code/environments/production/modules/mdwcfg/metadata.json)
Warning: Module 'mdwcfg': Hierarchy entry "wld-pil-04" must use keys qualified with the name of the module
Warning: Module 'mdwcfg': Hierarchy entry "wld-pil-04" must use keys qualified with the name of the module
Warning: Undefined variable 'domain_env';
(file & line not available)
Warning: Undefined variable 'domain_number';
(file & line not available)
Debug: Automatic Parameter Lookup of 'mdwcfg::domain_name
Searching for "lookup_options"
Global Data Provider (hiera configuration version 5)
No such key: "lookup_options"
Module "mdwcfg" Data Provider (hiera configuration version 5)
Using configuration "/etc/puppetlabs/code/environments/production/modules/mdwcfg/hiera.yaml"
Merge strategy hash
Hierarchy entry "wld-pil-03"
Path "/etc/puppetlabs/code/environments/production/modules/mdwcfg/data/wld-pil-03.yaml"
Original path: "wld-pil-03.yaml"
No such key: "lookup_options"
Hierarchy entry "wld-pil-04"
Path "/etc/puppetlabs/code/environments/production/modules/mdwcfg/data/wld-pil-04.yaml"
Original path: "wld-pil-04.yaml"
No such key: "lookup_options"
Hierarchy entry "jdk"
Path "/etc/puppetlabs/code/environments/production/modules/mdwcfg/data/jdk.yaml"
Original path: "jdk.yaml"
No such key: "lookup_options"
Hierarchy entry "common"
Path "/etc/puppetlabs/code/environments/production/modules/mdwcfg/data/common.yaml"
Original path: "common.yaml"
No such key: "lookup_options"
Searching for "mdwcfg::domain_name"
Global Data Provider (hiera configuration version 5)
No such key: "mdwcfg::domain_name"
Module "mdwcfg" Data Provider (hiera configuration version 5)
Using configuration "/etc/puppetlabs/code/environments/production/modules/mdwcfg/hiera.yaml"
Hierarchy entry "wld-pil-03"
Path "/etc/puppetlabs/code/environments/production/modules/mdwcfg/data/wld-pil-03.yaml"
Original path: "wld-pil-03.yaml"
No such key: "mdwcfg::domain_name"
Hierarchy entry "wld-pil-04"
Path "/etc/puppetlabs/code/environments/production/modules/mdwcfg/data/wld-pil-04.yaml"
Original path: "wld-pil-04.yaml"
Interpolation on "wld-%{mdwcfg::domain_env}-%{mdwcfg::domain_number}"
Global Scope
Global Scope
Found key: "mdwcfg::domain_name" value: "wld--"
Debug: Lookup of 'mdwcfg::domain_name'
Searching for "lookup_options"
Global Data Provider (hiera configuration version 5)
No such key: "lookup_options"
Module "mdwcfg" Data Provider (hiera configuration version 5)
Using configuration "/etc/puppetlabs/code/environments/production/modules/mdwcfg/hiera.yaml"
Merge strategy hash
Hierarchy entry "wld-pil-03"
Path "/etc/puppetlabs/code/environments/production/modules/mdwcfg/data/wld-pil-03.yaml"
Original path: "wld-pil-03.yaml"
No such key: "lookup_options"
Hierarchy entry "wld-pil-04"
Path "/etc/puppetlabs/code/environments/production/modules/mdwcfg/data/wld-pil-04.yaml"
Original path: "wld-pil-04.yaml"
No such key: "lookup_options"
Hierarchy entry "jdk"
Path "/etc/puppetlabs/code/environments/production/modules/mdwcfg/data/jdk.yaml"
Original path: "jdk.yaml"
No such key: "lookup_options"
Hierarchy entry "common"
Path "/etc/puppetlabs/code/environments/production/modules/mdwcfg/data/common.yaml"
Original path: "common.yaml"
No such key: "lookup_options"
Searching for "mdwcfg::domain_name"
Global Data Provider (hiera configuration version 5)
No such key: "mdwcfg::domain_name"
Module "mdwcfg" Data Provider (hiera configuration version 5)
Using configuration "/etc/puppetlabs/code/environments/production/modules/mdwcfg/hiera.yaml"
Hierarchy entry "wld-pil-03"
Path "/etc/puppetlabs/code/environments/production/modules/mdwcfg/data/wld-pil-03.yaml"
Original path: "wld-pil-03.yaml"
No such key: "mdwcfg::domain_name"
Hierarchy entry "wld-pil-04"
Path "/etc/puppetlabs/code/environments/production/modules/mdwcfg/data/wld-pil-04.yaml"
Original path: "wld-pil-04.yaml"
Interpolation on "wld-%{mdwcfg::domain_env}-%{mdwcfg::domain_number}"
Global Scope
Global Scope
Found key: "mdwcfg::domain_name" value: "wld--"
Notice: Compiled catalog for vm-lab-linux-1.msc.es in environment production in 0.15 seconds
Debug: Creating default schedules
Debug: Loaded state in 0.00 seconds
Debug: Loaded state in 0.00 seconds
Debug: Loaded transaction store file in 0.00 seconds
Info: Applying configuration version '1497262320'
Notice: a: wld--
Notice: /Stage[main]/Main/Notify[a: wld--]/message: defined 'message' as 'a: wld--'
Debug: /Stage[main]/Main/Notify[a: wld--]: The container Class[Main] will propagate my refresh event
Debug: Class[Main]: The container Stage[main] will propagate my refresh event
Debug: Finishing transaction 31423700
Debug: Storing state
Debug: Stored state in 0.01 seconds
Notice: Applied catalog in 0.05 seconds
Debug: Applying settings catalog for sections reporting, metrics
Debug: Finishing transaction 34689140
Debug: Received report to process from vm-lab-linux-1.msc.es
Debug: Evicting cache entry for environment 'production'
Debug: Caching environment 'production' (ttl = 0 sec)
Debug: Processing report from vm-lab-linux-1.msc.es with processor Puppet::Reports::Store
Am I doing something wrong?
thanks in advance,
Raúl
↧