Anything in the puppet master logs? Not sure, but i think puppet apply - hiera lookup is done by client, puppet agent - lookup is done by puppet master.
Andrey On 6 Jan 2014 21:33, "kai" <[email protected]> wrote: > Yes it's defined in : > > *"%{::domain}/%{::environment}/%{::osfamily}/%{::lsbdistcodename}"* > > which is expanded to loc.example.com/production/Debian/wheezy.yaml > > The problem is that when I run: > > $ puppet apply --environment=production -e '$test = > hiera('ssh_service_config') notify { $test: }' > > Debug: hiera(): Looking for data source > loc.example.com/production/Debian/wheezy > Debug: hiera(): Found ssh_service_config in > loc.example.com/production/Debian/wheezy > > it works just fine, but when I use: > > $ puppet agent -tv > > it fails to find the variable. If I remove the *%{::domain} *however then > it works with puppet agent as well. > > $ facter domain > loc.example.com > > > > On Monday, January 6, 2014 2:34:00 PM UTC-6, Andrew wrote: >> >> I assume "ssh_service_config" is indeed defined in your yaml file? >> >> I would suggest to define it in the top level hierarchy in "defaults" and >> then gradually move 1 level down until you find when it "disappears". >> >> Andrey >> >> >> On 6 January 2014 19:20, kai <[email protected]> wrote: >> >>> I have the following hiera.yaml file: >>> >>> --- >>> :backends: >>> - yaml >>> - file >>> >>> :hierarchy: >>> - defaults >>> - "%{clientcert}" >>> * - "%{::domain}/%{::environment}/%{::osfamily}/%{::lsbdistcodename}"* >>> - global >>> >>> :yaml: >>> :datadir: /etc/puppet/data >>> >>> and the following in /etc/puppet/data: >>> >>> *loc.example.com/production/Debian/wheezy.yaml >>> <http://loc.example.com/production/Debian/wheezy.yaml>* >>> >>> The domain fact returns loc.example.com, the osfamily fact returns >>> Debian and the lsbdistcodename returns wheezy. >>> >>> >>> When I run >>> >>> puppet apply --environment=production -e '$test = >>> hiera('ssh_service_config') notify { $test: }' >>> >>> I get the ssh_service_config variable from the /etc/puppet/data/ >>> loc.example.com/production/Debian/wheezy.yaml file, which in my mind >>> means that the correct file was chosen based on the 3 facts (environment. >>> osfamily and lsbdistcodename), which is what I want. >>> >>> However if I run: >>> >>> $ puppet agent -tv --environment=production >>> Info: Retrieving plugin >>> Error: Could not retrieve catalog from remote server: Error 400 on >>> SERVER: Could not find data item ssh_package_name in any Hiera data file >>> and no default supplied at /srv/puppet/environments/ >>> production/modules/ssh/manifests/install.pp:2 on node >>> puppetmaster.iad3.example.com >>> Warning: Not using cache on failed catalog >>> Error: Could not retrieve catalog; skipping run >>> >>> Or: >>> >>> $ hiera -d ssh_service_config environment=production osfamily=Debian >>> lsbdistcodename=wheezy >>> DEBUG: 2014-01-06 19:18:08 +0000: Hiera YAML backend starting >>> DEBUG: 2014-01-06 19:18:08 +0000: Looking up ssh_service_config in YAML >>> backend >>> DEBUG: 2014-01-06 19:18:08 +0000: Looking for data source defaults >>> DEBUG: 2014-01-06 19:18:08 +0000: Looking for data source global >>> DEBUG: 2014-01-06 19:18:08 +0000: Hiera File backend starting >>> DEBUG: 2014-01-06 19:18:08 +0000: Looking up ssh_service_config in File >>> backend >>> DEBUG: 2014-01-06 19:18:08 +0000: Hiera File_backend: looking for data >>> source 'defaults' >>> DEBUG: 2014-01-06 19:18:08 +0000: Cannot find datafile >>> /var/lib/hiera/defaults.d, skipping >>> DEBUG: 2014-01-06 19:18:08 +0000: Hiera File_backend: looking for data >>> source 'global' >>> DEBUG: 2014-01-06 19:18:08 +0000: Cannot find datafile >>> /var/lib/hiera/global.d, skipping >>> nil >>> >>> Any idea what is going on? I would like to have a simple hierarchy like >>> the one in the hiera.yaml file, based on the three facts. >>> >>> -- >>> 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/f139fb4c-92f2-4616-a522-6bd69ecfd9fb% >>> 40googlegroups.com. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> >> -- > 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/126d00bd-2254-49a0-938b-db55a828a702%40googlegroups.com > . > For more options, visit https://groups.google.com/groups/opt_out. > -- 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/CACzr%3DFf5QvFxJZkOqA-0CZHLnPyQViN7F4hhOYdGK8EVAAkv-g%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
