hiera 5 postgresql backend

19 views
Skip to first unread message

Matt Zagrabelny

unread,
Apr 13, 2022, 10:30:24 PM4/13/22
to puppet...@googlegroups.com
Greetings,

I'm running puppet 5.5.

Is anyone aware of a hiera 5 Pg backend?

I've tried getting the hiera 3 module [0] working, but am struggling. I'm hoping a native hiera 5 will be a smoother experience.

Thanks for the help!

-m



Martin Alfke

unread,
Apr 14, 2022, 2:21:41 AM4/14/22
to puppet...@googlegroups.com
Hi,

We usually recommend to not use any other backend, except for file based backends, due to performance.
Any other backend must be able to deliver the same lookup speed.
We did a calculation at a customer and we saw hiera answering 8000 queries in less than 1 second using the yaml file backend.

With hiera5 you can of course write new backends.
Please note that the hiera3 backends are not compatible with hiera5!

Hth,
Martin


--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAOLfK3U6euXrZfWHLcSWjm-BHrxLq0oir8p2x-O4ExMe1TCrdA%40mail.gmail.com.

Matt Zagrabelny

unread,
Apr 15, 2022, 1:34:39 PM4/15/22
to puppet...@googlegroups.com
Hi Martin,

Thanks for the email. I understand your concerns about using other backends. We have a reasonably small puppet deployment, so I think I will try a DB based backend and see how it performs.

In that light, I've downloaded a hiera-mysql2 module from github and installed it at:

# tree /usr/share/puppet/modules/hiera-mysql2
/usr/share/puppet/modules/hiera-mysql2
├── CHANGELOG.md
├── lib
│   └── puppet
│       └── functions
│           └── mysql2_lookup_key.rb
├── LICENSE
├── metadata.json
└── README.md

I've updated my /etc/puppet/hiera.yaml to include an entry for looking up data using hiera-mysql2:

# head /etc/puppet/hiera.yaml
version: 5

defaults:
    datadir: /etc/puppet/code/hiera
    data_hash: yaml_data

hierarchy:
    - name: "MySQL lookup"
      lookup_key: mysql2_lookup_key
      options:

And I've restarted my puppetmaster.

When I attempt a lookup, either locally on the puppet master (or on an client system via puppet agent -t), I get:

# puppet  lookup foo::bar --explain
Searching for "lookup_options"
  Global Data Provider (hiera configuration version 5)
    Using configuration "/etc/puppet/hiera.yaml"
    Hierarchy entry "MySQL lookup"
Unable to find 'lookup_key' function named 'mysql2_lookup_key' (file: /etc/puppet/hiera.yaml)

I did not use "puppet module" to install the module, I just copied the files to the directory.

My module path looks good. Notice the last entry in the following path output...

# puppet config print modulepath
/etc/puppet/code/environments/production/modules:/etc/puppet/code/environments/production/profiles:/etc/puppet/code/environments/production/roles:/etc/puppet/modules:/etc/puppet/profiles:/etc/puppet/roles:/usr/share/puppet/modules

Can anyone help me understand why the puppetmaster isn't seeing the hiera-mysql2 module (and function contained therein) ?

Thank you for your consideration.

-m

Matt Zagrabelny

unread,
Apr 15, 2022, 3:17:05 PM4/15/22
to puppet...@googlegroups.com
A little bit more information...

puppet module list does not list the module:

# puppet module list | tail
/usr/share/puppet/modules
├── crayfishx-hiera_mysql (v3.0.1)
├── nanliu-staging (v1.0.4)
├── puppetlabs-apt (v6.1.1)  invalid
├── puppetlabs-concat (v5.1.0)  invalid
├── puppetlabs-mysql (v5.3.0)
├── puppetlabs-postgresql (v5.4.0)
├── puppetlabs-stdlib (v5.0.0)  invalid
├── puppetlabs-translate (v1.1.0)
└── puppetlabs-vcsrepo (v3.0.0)
 
However, it exists on disk:

# ls -1 /usr/share/puppet/modules
apt
concat
hiera_mysql
hiera-mysql2
mysql
postgresql
staging
stdlib
translate
vcsrepo

Any ideas how to get puppet to see the modules that exist "on disk" ?
Reply all
Reply to author
Forward
0 new messages