Call puppet define from Hiera

115 views
Skip to first unread message

Ben Parry

unread,
Aug 28, 2023, 3:28:07 PM8/28/23
to Puppet Users
Puppeteers,

I am bashing my head against a wall try to call a custom defined resource (I think that's the right terminology) from Heira.

I've created a class (appconfig) and within that I have used Puppet PDK to create a define to create an application config file (loadconf).  It works perfectly if I call the code from a Puppet manifest, like so;

appconfig::loadconf {
   '/etc/myapp/config.conf':
    tcpport  => 443
    loglevel => debug }

It's pretty much identical to the Puppet supplied example;


The problem is I want separate my data from the puppet code.  I am using Hiera (5) and when I add what I think should be in the YAML for calling my custom resource it does NOTHING!  No Error message, nothing it just completes normally without calling my custom resource.  My Hiera YAML document looks something like this;

---
classes:
  - appconfig

appconfig::loadconf:
  /etc/myapp/config.conf:
    tcpport: 443
    loglevel: debug

I have no idea why this is not being evaluated.  I have also tried using a 3rd party module to load with no results just message saying no such resource.  I used this module (which is excellent!);


Martin Alfke

unread,
Aug 31, 2023, 4:55:37 AM8/31/23
to puppet...@googlegroups.com
You either need a appconfig/manifests/init.pp class, or you can make use of stdlib::manage class and add the defined type to hiera

--
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/2cb98212-2bc1-4ce7-80db-0cb84eb16b23n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages