Hello, I am testing out hiera and trying to pass some hiera values to a module so that it can do specific tasks for a given node which does not seem to be working. Here is my setup:
-- # puppet lookup --hiera_config=/root/test/puppetlabs/code/environments/production/hiera.yaml nodetype --- mgmt # puppet apply --hiera_config=/root/test/puppetlabs/code/environments/production/hiera.yaml --modulepath /root/test/puppetlabs/code/environments/production/modules /root/test/puppetlabs/code/environments/production/manifests/site.pp Warning: The function 'hiera_include' is deprecated in favor of using 'lookup'. See https://puppet.com/docs/puppet/6.9/deprecated_language.html (file & line not available) Error: Evaluation Error: Error while evaluating a Function Call, Class[Foo]: expects a value for parameter 'nodetype' (file: /root/test/puppetlabs/code/environments/production/manifests/site.pp, line: 2, column: 3) on node node1.test.org # cat /root/test/puppetlabs/code/environments/production/hiera.yaml | grep -v '#' --- version: 5 defaults: datadir: data data_hash: yaml_data hierarchy: - name: "Yaml heirarchy" data_hash: yaml_data paths: - "nodes/%{facts.networking.fqdn}.yaml" - "roles/common.yaml" - 'common.yaml' # cat /root/test/puppetlabs/code/environments/production/data/nodes/node1.test.org.yaml --- nodetype: 'mgmt' classes: - foo # cat /root/test/puppetlabs/code/environments/production/manifests/site.pp node default { hiera_include('classes') } # cat /root/test/puppetlabs/code/environments/production/modules/foo/manifests/init.pp class foo ( String $nodetype, ){ if $nodetype == 'mgmt' { file { "/tmp/hello": ensure => file, source => 'puppet:///modules/foo/hello.mgmt', } } elsif $nodetype == 'login' { file { '/tmp/hello': ensure => file, source => 'puppet:///modules/foo/hello.login', } } } -- Not sure what I am missing here, but any guidance would be helpful. Also, let me know if there is a better way to tackle this. Thanks, -J -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAKyjK52YXktitNNd-CL8Te0pLZ5Gw2WNVdusa4-Hd_Wje7EfYw%40mail.gmail.com.
