Hiera Data Binding not working on some modules

142 views
Skip to first unread message

Julio Guevara

unread,
Mar 2, 2016, 11:41:05 AM3/2/16
to Puppet Users
Hi Puppet Users,

the situation is as follow. I have been trying to use the Data binding feature of hiera for this module https://forge.puppetlabs.com/jlambert121/puppet i have the following:

dist/profiles/manifests/puppet_master.pp
class profiles::puppet_master ($hello) {
  include
::puppet
  notify
{ $hello : }
}

dist/roles/manifests/puppet_master.pp
class roles::puppet_master {
  include profiles
::puppet_master
}


hieradata/node/example.domain.yaml
---
role
:
 
- '::roles::puppet_master'

profiles
::puppet_master::hello: 'Hello World'
puppet
::server: true
puppet
::server_version: 'latest'
puppet
::dns_alt_names:
 
- 'puppet.domain'
puppet
::puppetdb_server: 'puppet.domain'
puppet
::puppetdb: true
puppet
::manage_puppetdb: false
puppet
::manage_hiera: false
puppet
::firewall: true


puppetdb
::listen_address: '0.0.0.0'


hiera
::hierarchy:
 
- 'node/%%{::}{networking.fqdn}'
 
- 'type/%%{::}{type}'
 
- 'location/%%{::}{location}/%%{::}{type}'
 
- 'location/%%{::}{location}'
 
- 'common'
hiera
::datadir: '/etc/puppetlabs/code/environments/%%{::}{::environment}/hieradata'

r10k
::version: '2.1.1'
r10k
::sources:
  environments
:
    remote
: 'g...@xxx.xxx.xxx.xxx:puppet-control'
    basedir
: '%%{::}{settings.environmentpath}'
    prefix
: false
r10k
::manage_modulepath: false

The thing is that i can mange to data bind with hiera the value profiles::puppet_master::hello, but i'm unable to do the same thing for all the other values.
Because of this they go to their defaults values and actually uninstall my puppet server on the master :/

Can you guys help me out figuring why this is working for the puppet_master class but not for the puppet module?

Thanks
Julio

Julio Guevara

unread,
Mar 2, 2016, 3:37:38 PM3/2/16
to Puppet Users
Running the puppetserver on debug mode i got the following:

puppet::server
2016-03-02 13:25:27,995 DEBUG [puppet-server] Puppet Performing a hiera indirector lookup of puppet::server with options {:variables=>Scope(Class[Puppet]), :merge=>#<Puppet::Pops::FirstFoundStrategy:0x72e2d028 @options_t=#<Puppet::Pops::Types::PStructType:0x8d02d05 @elements=[#<Puppet::Pops::Types::PStructElement:0x6984496f @key_type=#<Puppet::Pops::Types::POptionalType:0x6bf14c87 @optional_type=#<Puppet::Pops::Types::PStringType:0x2ed76a6e @values=["strategy"], @size_type=nil>>, @value_type=#<Puppet::Pops::Types::POptionalType:0x45057093 @optional_type=#<Puppet::Pops::Types::PPatternType:0x6821e64b @patterns=[#<Puppet::Pops::Types::PRegexpType:0x767b5004 @regexp=/first/, @pattern="first">]>>>]>, @options={}>}
2016-03-02 13:25:27,995 DEBUG [puppet-server] Puppet hiera(): Looking up puppet::server in YAML backend
2016-03-02 13:25:27,996 DEBUG [puppet-server] Puppet hiera(): Looking for data source node/kcinf-puppetdb01p.infrastructure.us.loc
2016-03-02 13:25:27,996 DEBUG [puppet-server] Puppet hiera(): Cannot find datafile /etc/puppetlabs/code/environments//hieradata/node/example.domain, skipping
2016-03-02 13:25:27,997 DEBUG [puppet-server] Puppet hiera(): Looking for data source type/PUPPETDB
2016-03-02 13:25:27,997 DEBUG [puppet-server] Puppet hiera(): Cannot find datafile /etc/puppetlabs/code/environments//hieradata/type/PUPPETDB.yaml, skipping
2016-03-02 13:25:27,997 DEBUG [puppet-server] Puppet hiera(): Looking for data source location/KC/PUPPETDB
2016-03-02 13:25:27,998 DEBUG [puppet-server] Puppet hiera(): Cannot find datafile /etc/puppetlabs/code/environments//hieradata/location/KC/PUPPETDB.yaml, skipping
2016-03-02 13:25:27,998 DEBUG [puppet-server] Puppet hiera(): Looking for data source location/KC
2016-03-02 13:25:27,998 DEBUG [puppet-server] Puppet hiera(): Cannot find datafile /etc/puppetlabs/code/environments//hieradata/location/KC.yaml, skipping
2016-03-02 13:25:27,998 DEBUG [puppet-server] Puppet hiera(): Looking for data source common
2016-03-02 13:25:27,999 DEBUG [puppet-server] Puppet hiera(): Cannot find datafile /etc/puppetlabs/code/environments//hieradata/common.yaml, skipping

profiles::puppet_master::hello
2016-03-02 13:25:27,951 DEBUG [puppet-server] Puppet Performing a hiera indirector lookup of profiles::puppet_master::hello with options {:variables=>Scope(Class[Profiles::Puppet_master]), :merge=>#<Puppet::Pops::FirstFoundStrategy:0x737660ac @options_t=#<Puppet::Pops::Types::PStructType:0x60c4f76c @elements=[#<Puppet::Pops::Types::PStructElement:0x5a7df976 @key_type=#<Puppet::Pops::Types::POptionalType:0x484e064 @optional_type=#<Puppet::Pops::Types::PStringType:0x2fa7c78d @values=["strategy"], @size_type=nil>>, @value_type=#<Puppet::Pops::Types::POptionalType:0x64b8922 @optional_type=#<Puppet::Pops::Types::PPatternType:0x49181a68 @patterns=[#<Puppet::Pops::Types::PRegexpType:0x6239c529 @regexp=/first/, @pattern="first">]>>>]>, @options={}>}
2016-03-02 13:25:27,951 DEBUG [puppet-server] Puppet hiera(): Looking up profiles::puppet_master::hello in YAML backend
2016-03-02 13:25:27,952 DEBUG [puppet-server] Puppet hiera(): Looking for data source node/example.domain
2016-03-02 13:25:27,952 DEBUG [puppet-server] Puppet hiera(): Found profiles::puppet_master::hello in node/example.domain

it seems to be that the environment is nil when trying to look for the puppet::server key but it is there for the profiles::puppet_master::hello search.
Any idea?
Reply all
Reply to author
Forward
0 new messages