Trouble translating Hiera 3 -> 5 config file

25 views
Skip to first unread message

Bret Wortman

unread,
May 30, 2017, 11:09:08 AM5/30/17
to Puppet Users
I'm working on upgrading to the Hiera 5 spec and moving away from our global config, but to do that I need to first make sure I have a working H5 config file, so I set to translating our current one using the Puppetlabs documentation.

I must be missing something critical because a slew of things get defined differently when I run with the H5 file so I haven't been able to cut over to it successfully yet.

Hiera 3 version:
---
:backends:
  - yaml

:yaml:
  :datadir: "/etc/puppetlabs/code/environments/%{::environment}/hieradata"

:hierarchy:
  - "%{::hostname}"
  - "%{::sitename}"
  - common

Hiera 5 version:
---
version: 5
defaults:
  datadir: hieradata
  data_hash: yaml_data
hierarchy:
  - name: "Per-node data"
    path: "%{facts.hostname}.yaml"

  - name: "Per-site data"
    path: "%{facts.sitename}.yaml"

  - name: "Other data"
    paths:
      - "common.yaml"

-----------

Am I missing something simple? Is there a good way to test (and the "debugging hiera" page is pretty much useless if you're at this point and are using environments to store your hiera data).

Henrik Lindberg

unread,
May 31, 2017, 5:56:48 AM5/31/17
to puppet...@googlegroups.com
You can test with the CLI 'puppet lookup --explain' - you probably want
to make sure your node has called in to the master first so the facts
are available for it, but can run for the current node as well.

You also get the explain style output in the puppet log if you are
running with debug level logging turned on when compiling a catalog.

- henrik

> --
> 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 puppet-users...@googlegroups.com
> <mailto:puppet-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/ee507df8-8c6f-429a-9f95-a924b8c8960b%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/ee507df8-8c6f-429a-9f95-a924b8c8960b%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.


--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

Bret Wortman

unread,
May 31, 2017, 7:54:33 AM5/31/17
to Puppet Users
When run on the master querying a node that isn't the master:

# puppet lookup --node zw129 --explain sudo::disable_sssd
Merge strategy first
  Data Binding "hiera"
    No such key: "sudo::disable_sssd"
  Data Provider "Environment Data Provider"
    No such key: "sudo::disable_sssd"
  Module "sudo" using Data Provider "Module DataProvider"
    No such key: "sudo::disable_sssd"
#

But I know from the way the manifest behaves on that system that this should return "true". Am I missing another parameter or option?

Reply all
Reply to author
Forward
0 new messages