0

I have spent a couple of days on this, followed the instructions on http://downloads.puppetlabs.com/docs/puppetmanual.pdf and even the Puppet Training Advanced Puppet manual.

When I run a test against it, the results always come back as 'nil' and Im not sure why. I am running Puppet 3.6.1 Community Edition, with Hiera 1.2.1 on SLES 11.

My puppet.conf file at /etc/puppet/puppet.conf consists of:

[main]
    # The Puppet log directory.
    # The default value is '$vardir/log'.
    logdir = /var/log/puppet

    # Where Puppet PID files are kept.
    # The default value is '$vardir/run'.
    rundir = /var/run/puppet

    # Where SSL certificates are kept.
    # The default value is '$confdir/ssl'.
    ssldir = $vardir/ssl
    certificate_revocation = false

 [master]
    hiera_config=/etc/puppet/hiera.yaml
    reporturl = http://puppet2.vvmedia.com/reports/upload
    ssl_client_header = SSL_CLIENT_S_DN
    ssl_client_verify_header = SSL_CLIENT_VERIFY

#    certname = dev-puppetmaster2.vvmedia.com
#    ca_name = 'dev-puppetmaster2.vvmedia.com'
#    facts_terminus = rest
#    inventory_server = localhost
#    ca = false
[agent]
    # The file in which puppetd stores a list of the classes
    # associated with the retrieved configuratiion.  Can be loaded in
    # the separate ``puppet`` executable using the ``--loadclasses``
    # option.
    # The default value is '$confdir/classes.txt'.
    classfile = $vardir/classes.txt

    # Where puppetd caches the local configuration.  An
    # extension indicating the cache format is added automatically.

    # The default value is '$confdir/localconfig'.
    localconfig = $vardir/localconfig

my /etc/puppet/hiera.yaml consists of:

:backends: yaml
:yaml:
  :datadir: /etc/puppet/hieradata
:hierarchy:
  - common
  - database

I have a directory created in /etc/puppet/hieradata and within it contains:

/etc/puppet/hieradata/common.yaml

:nameserver:  ["dnsserverfoo1", "dnsserverfoo2"]
:smtp_server:  relay.internalfoo.com
:syslog_server:  syslogfoo.com
:logstash_shipper:  logstashfoo.com
:syslog_backup_nfs:  nfsfoo:/vol/logs
:auth_method:  ldap
:manage_root:  true

and /etc/puppet/hieradata/database.yaml

:enable_graphital: true
:mysql_server_package: MySQL-server
:mysql_client_package: MySQL-client
:allowed_groups_login: extranet_users

does anyone have any idea what could be causing Hiera to not load the requested values? I have tried even restarting the Master. Thanks in advance, Cole

Cole Shores
  • 123
  • 2
  • Why are you prefixing your hiera keys in common.yaml and database.yaml with a colon? That doesn't look right but I can't verify that right now. – faker Jun 03 '14 at 20:15

2 Answers2

0

I believe you are using the wrong syntax in your yaml files.
It should look like this:

---
enable_graphital: true
mysql_server_package: MySQL-server
mysql_client_package: MySQL-client
allowed_groups_login: extranet_users

Or even more correctly your_class::enable_graphital: true.
But that depends on how you use hiera in your manifest.

faker
  • 17,326
  • 2
  • 60
  • 69
  • @ColeShores you are welcome! Please accept it as the answer so that in the future people with the same problem have it easier to find the answer. – faker Jun 04 '14 at 21:52
0

When debugging using the hiera command, remember that:

  1. It needs to run on the master (usually)
  2. It looks for /etc/hiera.yaml (not /etc/puppet/hiera.yaml). Create a symlink if that makes it easier for you.
  3. It looks for /var/lib/hiera for data. You might need to make that a symlink to where you put the hiera data
TomOnTime
  • 7,567
  • 6
  • 28
  • 51