puppetlabs-postgrest module not loaded

115 views
Skip to first unread message

Alfredo De Luca

unread,
Aug 29, 2015, 12:31:29 AM8/29/15
to puppet...@googlegroups.com
Hi all.
Using Puppet open source 3.8 with hiera for test purpose.

I installed puppetlabs-postgresql from forge but when on my puppet
client yaml I use postgresql I got the following error:


Error: Could not retrieve catalog from remote server: Error 400 on
SERVER: Could not find class postgresql for puppet-sql.alflab.net on
node puppet-sql.alflab.net


Any clue why?

Here is the yaml file

---
classes:
- sudo
- selinux
- postgresql

All the rest is working just fine. Also I tried puppetlabs-mysql but
same error.

Regards

--
Alfredo

Alfredo De Luca

unread,
Aug 31, 2015, 12:12:32 AM8/31/15
to puppet...@googlegroups.com
Hi all.
I found out that niether puppetlabs-postgresql or mysql has the
init.pp so that's why when I call them from hiera they fail.
Is it normal?

Alfredo
--
Alfredo

Rich Burroughs

unread,
Aug 31, 2015, 1:02:40 AM8/31/15
to puppet...@googlegroups.com
A lot of modules do have one, but not all of them. It's not required, it's a design decision.

You should be able to add the classes you want to assign using the proper scoping like:

mysql::server


Rich
--
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/CAAWpFTFioMKsLcNDKtKtG8o5Fo7X7Z-kBzqCWsp2VasRGNZBLQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Alfredo De Luca

unread,
Aug 31, 2015, 1:43:14 AM8/31/15
to puppet...@googlegroups.com
Hi Rich.Thanks for that but when I try to do so I got that error

Error: Could not retrieve catalog from remote server: Error 400 on
SERVER: Could not find class postgresql for puppet-sql.alflab.net on
node puppet-sql.alflab.net

It seems it can't find the class at all even it's all there and that's
why I thought the init.pp would be why.
Alfredo
> https://groups.google.com/d/msgid/puppet-users/CAPGcbtCceoq9ks%2Brvux7_x%3DFj6GUZLTvRr7jftXW8RstFcerGg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



--
Alfredo

Rich Burroughs

unread,
Aug 31, 2015, 2:18:27 AM8/31/15
to puppet...@googlegroups.com
The one in your example was:

postgresql

And yes that won't work because there's not an init.pp. There's actually not a class in the module called postgresql.

You need to use the specific classes like:

postgresql::client
postgresql::server

Whichever ones you need. There is a list of them on the Forge page.

If that's not working I'm not sure why. Maybe you could paste in your new example and the error.

Rich Burroughs

unread,
Aug 31, 2015, 2:20:38 AM8/31/15
to puppet...@googlegroups.com
Also if any of that is unclear there is a doc on auto loading and namespacing here:

https://docs.puppetlabs.com/puppet/latest/reference/lang_namespaces.html

Alfredo De Luca

unread,
Sep 1, 2015, 2:20:32 AM9/1/15
to puppet...@googlegroups.com
Hi Rich.
Thanks.

I tried without - postgresql. Only adding
postgresql::server::db: test
postgresql::server::password: test
postgresql::server::user: test

What happens is I don't get that error but it doesn't do anything either.

Alfredo


On Sat, Aug 29, 2015 at 2:31 PM, Alfredo De Luca
<alfredo...@gmail.com> wrote:
--
Alfredo

Rich Burroughs

unread,
Sep 1, 2015, 2:59:10 AM9/1/15
to puppet...@googlegroups.com
Yeah that is not going to work.

Your Hiera file is a list of classes you're including on the host, I'm assuming your code is using the hiera_include function. Basically Puppet is turning the classes listed in that file into an array and then trying to apply them all. What you've done is try to include the same class three times. That won't work.

You would just do:

postgresql::server

Just that one line.

But then it would get applied with all of the default parameters. If you want to override any of the default parameters, you could just set those elsewhere in your Hiera data.

If you google hiera_include I know there are some docs about it.

Another option would be to skip this route and just apply the class to the node in your site.pp or roles/profiles if you have them. Then you could override any parameters you want to at the same time. You would use that syntax that's on the Forge page.

A lot of this stuff is just preference but I'm not a fan of applying classes though Hiera like that. There are better ways to handle node classification in my opinion.


Rich

--
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.

jcbollinger

unread,
Sep 1, 2015, 9:08:46 AM9/1/15
to Puppet Users


On Monday, August 31, 2015 at 12:43:14 AM UTC-5, Alfredo De Luca wrote:
Hi Rich.Thanks for that but when I try to do so I got that error

Error: Could not retrieve catalog from remote server: Error 400 on
SERVER: Could not find class postgresql for puppet-sql.alflab.net on
node puppet-sql.alflab.net

It seems it can't find the class at all even it's all there and that's
why I thought the init.pp would be why.
Alfredo



Well, yes, that's pretty much it.  Many modules have a same-named class associated with them, but Puppet does not require it, and not all do have one.  In those modules that do have a same-named class, its definition is (conventionally) recorded in that module's init.pp file.  In those modules that do not have such a class, the init.pp file can be omitted.  Puppetlabs' postgresql module is one of those that does not have a same-named class.  You should consult its documentation to determine how to use it for your purposes.

Absence of a class 'postgresql' and absence of an init.pp file in module 'postgresql' are very much linked, just as you supposed, but the absence of both does not constitute an error.


John


jcbollinger

unread,
Sep 1, 2015, 9:40:16 AM9/1/15
to Puppet Users


On Tuesday, September 1, 2015 at 1:59:10 AM UTC-5, Rich Burroughs wrote:
Yeah that is not going to work.

Your Hiera file is a list of classes you're including on the host,


What makes you say that?  The Hiera fragment presented does not appear to satisfy that description, and the description certainly is not a general characterization of Hiera data.

 
I'm assuming your code is using the hiera_include function. Basically Puppet is turning the classes listed in that file into an array and then trying to apply them all.


Certainly not.  The hiera data presented are three separate keys / value pairs.  They appear to present parameter values for class postgres::server, and as such they look fine.  No standard Puppet function will combine these into an array automatically.

 
What you've done is try to include the same class three times. That won't work.


If that were what he had tried to do then it probably would work, because Puppet has no inherent problem with the same class being declared multiple times.  It only becomes an issue when the resource-like class declaration syntax employed, which is one of the major reasons to avoid that class-declaration syntax.

 

You would just do:

postgresql::server

Just that one line.


No, definitely not.  That one line by itself is neither valid YAML nor valid Puppet DSL, and that line is not a correct addition to the value of the 'classes' key that was earlier presented.  Replacing the current Hiera data with that will make the problem worse, not better.

More generally, though, it very likely is the case that the problem Alfredo last described is indeed that the 'postgresql::server' class is nowhere declared.  Including class parameter mappings among your hiera data is not sufficient to cause the target class to be declared, largely because recognizing the data as defining parameter mappings in the first place depends on there being a class declaration.

Supposing that somewhere in one of the manifests that are being evaluated for the target node there is a call to hiera_include('classes'), as the originally-presented data suggest, it seems an appropriate way to include 'postgres::server' class among those applied to the node would be to make the 'classes' entry in the Hiera data look like this:

classes:
 
- sudo
 
- selinux
 
- postgresql::server

(Note the indentation and leading hyphen.)  Supposing that class parameter values are to be provided via automatic data binding, Alfredo's alternative Hiera data should be added to the file.  It does not substitute for an entry in the 'classes' array:


postgresql::server::db: test
postgresql
::server::password: test
postgresql
::server::user: test

Note, too, that the data binding and class declaration are almost entirely orthogonal.  Without any class declaration, the parameter binding keys are (probably) unused, but not erroneous.  Moreover, a class declaration directly in DSL or via an ENC, instead of via hiera_include(), will draw on those same parameter bindings for any parameters whose values are not given in the declaration.  Thus, for example, instead of including postgresql::server in the 'classes' array, one could achieve the same result, modulo evaluation-order effects, by declaring

include 'postgresql::server'

in one of the manifests that is evaluated for the node, parameter bindings and all.  The include() is a non-exclusive alternative to declaring the class via hiera_include().


John

Rich Burroughs

unread,
Sep 1, 2015, 12:06:41 PM9/1/15
to Puppet Users
John, what made me say that is the thread. He was trying to apply a class to a node in his Hiera data that doesn't have an init.pp. It seems like he is new to class namespacing and didn't know how to apply a class that wasn't in init.pp. That's the discussion we were having.

I may have misunderstood his last message, rereading it now. I thought he thought he could declare the class by including those lines. It was late and it looks like I missed what he was trying to do. I'm not sure though because it still wasn't working for him. Your YAML looks good to me though and I think that should work.

But I was absolutely not saying that Hiera data is just a list of classes that you include on your node. That would be a pretty silly thing to say, right? I was speaking in the context of the original message, he and I had an ongoing discussion.

Honestly I'm not sure why you would assume that's what I was trying to say. I think you and I write/communicate differently. When I post a message here I'm not trying to make sweeping declarations about how things work, I'm trying to help someone with the problem they asked about.



Rich
--
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.

David Levray

unread,
Sep 2, 2015, 10:29:32 AM9/2/15
to Puppet Users
Hello,

please :
cat hiera.yaml
puppet module list
puppet module list --environment xxx   (xx = environment your node)

ty

Alfredo De Luca

unread,
Sep 3, 2015, 7:20:42 AM9/3/15
to puppet...@googlegroups.com
Hi all.
sorry for late reply. So....It's not completely wrong what I am trying
to do but still not working.
My idea its' not to have at all any node.pp or environment.pp etc but
drive everything from hiera/yaml.

I was able to do so till I need to install postgres because I'd like
to evaluate puppetDB.

Anyway here are the conf files you David asked

[root@puppet-server puppet]# cat hiera.yaml
---
:backends:
- yaml

:hierarchy:
- "%{::environment}/%{::environment}"
- "nodes/%{::fqdn}"
- common

:yaml:
:datadir: /etc/puppet/hieradata/

[root@puppet-server puppet]# puppet module list
Warning: Missing dependency 'puppetlabs-stdlib':
'alfredo-sropackages' (v0.1.0) requires 'puppetlabs-stdlib' (>= 1.0.0)
'alfredo-sroservices' (v0.1.0) requires 'puppetlabs-stdlib' (>= 1.0.0)
'alf-srotest' (v0.1.0) requires 'puppetlabs-stdlib' (>= 1.0.0)
'alf-srousers' (v0.1.0) requires 'puppetlabs-stdlib' (>= 1.0.0)
/etc/puppet/modules
├── alf-srotest (v0.1.0)
├── alf-srousers (v0.1.0)
├── alfredo-sropackages (v0.1.0)
├── alfredo-sroservices (v0.1.0)
├── bashtoni-timezone (v1.0.0)
├── camptocamp-augeas (v1.2.4)
├── camptocamp-postfix (v1.2.2)
├── example42-puppi (v2.1.10)
├── example42-resolver (v2.0.12)
├── example42-yum (v2.1.17)
├── nanliu-staging (v1.0.3)
├── puppetlabs-apache (v1.4.1)
├── puppetlabs-apt (v1.8.0)
├── puppetlabs-concat (v1.2.1)
├── puppetlabs-firewall (v1.5.0)
├── puppetlabs-inifile (v1.2.0)
├── puppetlabs-motd (v1.2.0)
├── puppetlabs-mysql (v3.6.0)
├── puppetlabs-ntp (v3.2.1)
├── puppetlabs-postgresql (v4.5.0)
├── puppetlabs-puppetdb (v5.0.0)
├── puppetlabs-stdlib (v4.8.0)
├── saz-ssh (v2.4.0)
├── saz-sudo (v3.0.9)
└── spiette-selinux (v0.5.4)
/usr/share/puppet/modules (no modules installed)
[root@puppet-server puppet]#

For the environment I use again hiera.yaml to split my environment.

Regards
> --
> 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/9835033d-4c83-4e53-b604-cf316c9239e0%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
Alfredo

jcbollinger

unread,
Sep 3, 2015, 10:16:32 AM9/3/15
to Puppet Users


On Thursday, September 3, 2015 at 6:20:42 AM UTC-5, Alfredo De Luca wrote:
Hi all.
sorry for late reply. So....It's not completely wrong what I am trying
to do but still not working.


As far as I can tell, in fact, what you're trying to do is mostly right.  You seem to be in better command of your site and situation than some of the earlier answers gave you credit for.

 
My idea its' not to have at all any node.pp or environment.pp etc but
drive everything from hiera/yaml.



Note that file names "node.pp" and "environment.pp" are not inherently meaningful.  I suppose you mean that you don't want to declare or use any node blocks (which do not necessarily have to appear in a file named node.pp).  Maybe you also mean you want to rely on default environment configuration, but that has nothing to do with any file named environment.pp.  Perhaps you mean instead that you don't want to write any "environment.conf" file.

 
I was able to do so till I need to install postgres because I'd like
to evaluate puppetDB.



Ok.  It's not clear what the problem is, or at least why what we already discussed did not solve it for you.

It seems you are already well aware of how to cause a class to be declared in your configuration: you cause its name to be included in the array associated with key "classes" in Hiera.  (For others who may read this, the key "classes" is conventional, but not special -- its significance is that there is a call to hiera_include('classes') in the this site's site manifest.)  The original problem was that you did not appreciate the distinction between a module and a class with the same name as that module, nor that modules are not required to contain such a class at all.  As a result, you attempted to declare a class that the Puppetlabs "postgresql" module does not, in fact, provide.  The solution to that problem is first and foremost to declare the correct class instead -- apparently "postgresql::server".  We covered that already, and you know how to do it.

There may be other classes you need to declare, and possibly first to write, to express your site-specific requirements for databases, users, etc. within your PostgreSQL server.  You apparently know how to write your own classes and modules as well, so I don't suppose that in itself is the problem.  You have only now mentioned why you are trying to configure postgres; it is the details in support of that use of postgres that would be covered by a class such as I describe.

As a secondary matter, you probably need to declare appropriate parameter values for class postgresql::server.  You have shown that you know how to declare class parameter values in Hiera as well.  You may need to find the correct parameter values for your purposes; if that's the issue then please focus the discussion there.

On the other hand, I would hope that the puppetdb package for your OS would take care of requiring PostgreSQL as a dependency, and of setting up the appropriate database, user, password, etc..  Thus, if using puppetdb is the sole reason for your attempt to manage a postgres server then perhaps your effort is going in the wrong direction.

Any way around, we can't help you very well without a clear idea of what exactly you're doing now, and what exactly Puppet is doing with that (which is not what you want it to do).  "Still not working" does not give us anything useful, particularly when we are uncertain what you're even doing that isn't working.


John

David Levray

unread,
Sep 3, 2015, 12:06:10 PM9/3/15
to Puppet Users
In  /etc/puppet/hieradata/nodes/ create a file 'puppet-sql.alflab.net.yaml' that contains:

---
postgresql::server:


restart your instance PuppetMaster (service httpd/apache2 restart)
Then we test hiera debug mode if it finds the information:

hiera -d postgresql::server
hiera -d sudo::configs fqdn=puppet-sql.alflab.net

or (for array)
hiera -d -a postgresql::server fqdn=puppet-sql.alflab.net

or (for hash):
hiera -d -h postgresql::server fqdn=puppet-sql.alflab.net


Can you give the return orders, please






Le samedi 29 août 2015 06:31:29 UTC+2, Alfredo De Luca a écrit :

Alfredo De Luca

unread,
Sep 4, 2015, 6:21:15 AM9/4/15
to puppet...@googlegroups.com
Hi David.
Here is the output.
[root@puppet-server puppet]# hiera -d postgresql::server
DEBUG: Fri Sep 04 20:18:29 +1000 2015: Hiera YAML backend starting
DEBUG: Fri Sep 04 20:18:29 +1000 2015: Looking up postgresql::server
in YAML backend
DEBUG: Fri Sep 04 20:18:29 +1000 2015: Looking for data source common
nil
[root@puppet-server puppet]# hiera -d postgresql::server
DEBUG: Fri Sep 04 20:19:04 +1000 2015: Hiera YAML backend starting
DEBUG: Fri Sep 04 20:19:04 +1000 2015: Looking up postgresql::server
in YAML backend
DEBUG: Fri Sep 04 20:19:04 +1000 2015: Looking for data source common
nil

[root@puppet-server puppet]#
[root@puppet-server puppet]# hiera -d sudo::configs fqdn=puppet-sql.alflab.net
DEBUG: Fri Sep 04 20:19:17 +1000 2015: Hiera YAML backend starting
DEBUG: Fri Sep 04 20:19:17 +1000 2015: Looking up sudo::configs in YAML backend
DEBUG: Fri Sep 04 20:19:17 +1000 2015: Looking for data source common
nil
[root@puppet-server puppet]# hiera -d -a postgresql::server
fqdn=puppet-sql.alflab.net
DEBUG: Fri Sep 04 20:19:23 +1000 2015: Hiera YAML backend starting
DEBUG: Fri Sep 04 20:19:23 +1000 2015: Looking up postgresql::server
in YAML backend
DEBUG: Fri Sep 04 20:19:23 +1000 2015: Looking for data source common
nil
[root@puppet-server puppet]# hiera -d -h postgresql::server
fqdn=puppet-sql.alflab.net
DEBUG: Fri Sep 04 20:19:31 +1000 2015: Hiera YAML backend starting
DEBUG: Fri Sep 04 20:19:31 +1000 2015: Looking up postgresql::server
in YAML backend
DEBUG: Fri Sep 04 20:19:31 +1000 2015: Looking for data source common
nil
> --
> 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/6a741c4e-35ad-43c2-bb2d-3c48c7bc558c%40googlegroups.com.

David Levray

unread,
Sep 4, 2015, 7:54:52 AM9/4/15
to Puppet Users

Thanks for your return.

It is noted that hiera your search directly in the common.yaml, it is not your path hierarchy.

 

Here's an example search or hiera good in the order of hierarchy:

My hierarchy is:


:hierarchy:

  - "node/%{fqdn}"

  - "virtual/%{virtual}"

  - "osfamily/%{osfamily}"

  - common

 

 

# hiera -d -m toto.local sudo::configs

DEBUG: Fri Sep 04 11:36:29 +0000 2015: Hiera YAML backend starting

DEBUG: Fri Sep 04 11:36:29 +0000 2015: Looking up sudo::configs in YAML backend

DEBUG: Fri Sep 04 11:36:29 +0000 2015: Looking for data source node/toto.local

DEBUG: Fri Sep 04 11:36:29 +0000 2015: Cannot find datafile /etc/puppet/hieradb/node/ toto.local .yaml, skipping

DEBUG: Fri Sep 04 11:36:29 +0000 2015: Looking for data source virtual/vmware

DEBUG: Fri Sep 04 11:36:29 +0000 2015: Cannot find datafile /etc/puppet/hieradb/virtual/vmware.yaml, skipping

DEBUG: Fri Sep 04 11:36:29 +0000 2015: Looking for data source osfamily/RedHat

DEBUG: Fri Sep 04 11:36:29 +0000 2015: Cannot find datafile /etc/puppet/hieradb/osfamily/RedHat.yaml, skipping

DEBUG: Fri Sep 04 11:36:29 +0000 2015: Looking for data source common

DEBUG: Fri Sep 04 11:36:29 +0000 2015: Found sudo::configs in common

{"toto"=>{"content"=>"toto ALL=(ALL) NOPASSWD: ALL"}}

 

 

 

So check the following:

1 / verifies that the file points /etc/hiera.yaml of your file  /etc/puppet/hiera.yaml:

ls -rtla /etc/hiera.yaml

     /etc/hiera.yaml -> /etc/puppet/hiera.yaml

 

2 / Check the owners:

Chown puppet: puppet /etc/puppet/hiera.yaml

Chown -R puppet: puppet / etc / puppet / hieradata /

 

Restart your instance Puppet Master for the changes to take effect.

Alfredo De Luca

unread,
Sep 7, 2015, 7:42:41 AM9/7/15
to puppet...@googlegroups.com
Hi David.
Here is the output


[root@puppet-server puppet]# ls -rtla /etc/hiera.yaml
lrwxrwxrwx 1 root root 22 Sep 4 14:46 /etc/hiera.yaml -> /etc/puppet/hiera.yaml
[root@puppet-server puppet]#



The owner was root so I changed it as per your suggestions so now it's puppet.
But still can't search with hiera. it seems to lookup only in common
but if I change something on the nodes/puppet-sql.alflab.net it gets
reflected into the node with the new catalog.

weird
Alfredo
> https://groups.google.com/d/msgid/puppet-users/e9614e98-4052-484b-8f14-abe6634a2238%40googlegroups.com.

David Levray

unread,
Sep 7, 2015, 8:27:28 AM9/7/15
to Puppet Users
Hello,

sorry, but I do understand your réponce:

but if I change something on the nodes/puppet-sql.alflab.net it gets 
reflected into the node with the new catalog. 

Mysql installed?

different commands past returns 'nil':
>> DEBUG: Fri Sep 04 20:19:04 +1000 2015: Looking up postgresql::server 
>> in YAML backend 
>> DEBUG: Fri Sep 04 20:19:04 +1000 2015: Looking for data source common 
>> nil 

This is possible because no variable is configured.
The easiest thing to set the configuration in common (to start) and set the hierarchy problem after.

Exemple: 
comon.yaml:
---
ssh::server_options:
        Port:                           '22'


Restart instance Puppet, and then repeat the search:

hiera -d -h ssh::server_options

DEBUG: Mon Sep 07 12:24:09 +0000 2015: Hiera YAML backend starting
DEBUG: Mon Sep 07 12:24:09 +0000 2015: Looking up ssh::server_options in YAML backend
DEBUG: Mon Sep 07 12:24:09 +0000 2015: Looking for data source common
DEBUG: Mon Sep 07 12:24:09 +0000 2015: Found ssh::server_options in common
{"PermitEmptyPasswords"=>"no",
 "AcceptEnv"=>"LANG LC_*",
 "MaxAuthTries"=>"3",
 "PasswordAuthentication"=>"yes",
 "AuthorizedKeysFile"=>"%h/.ssh/authorized_keys",
 "PubkeyAuthentication"=>"yes",
 "Banner"=>"/etc/issue.net",
 "ListenAddress"=>["127.0.0.0", "0.0.0.0"],
 "Subsystem"=>"sftp /usr/libexec/openssh/sftp-server",
 "PermitRootLogin"=>"yes",
 "PrintMotd"=>"yes",
 "X11Forwarding"=>"no",
 "Port"=>"22",
 "StrictModes"=>"yes",
 "SyslogFacility"=>"AUTHPRIV",
 "Protocol"=>"2",
 "AllowGroups"=>"*",
 "AFSTokenPassing"=>"no",
 "AllowUsers"=>"*",
 "ChallengeResponseAuthentication"=>"no",
 "AllowTcpForwarding"=>"no",
 "UsePAM"=>"yes"}

Alfredo De Luca

unread,
Sep 8, 2015, 2:29:11 AM9/8/15
to puppet...@googlegroups.com
Hi David. Sorry.. I meant if for example I add an user on
nodes/puppet-sql.alflab.net puppet will create that user.

Ok I will do what you suggested. But I think it's still not clear why
I can't user postgresql on nodes/puppet-sql.alflab.net and get the db
created/managed by puppet.

Alfredo
> https://groups.google.com/d/msgid/puppet-users/3b66e81e-25c9-4049-960e-59134cf3e232%40googlegroups.com.

jcbollinger

unread,
Sep 8, 2015, 10:19:39 AM9/8/15
to Puppet Users


On Friday, September 4, 2015 at 6:54:52 AM UTC-5, David Levray wrote:

Thanks for your return.

It is noted that hiera your search directly in the common.yaml, it is not your path hierarchy.



Oh, come on.  It is not erroneous to have an Hiera hierarchy consisting of only one level.  Correct operation of Hiera does not depend on there being more than one, as evidenced, for example, by the fact that Alfredo's configuration has been working for him except with respect to postgres.  All appearances point to the issue being associated with the details of the data that Hiera is providing to Puppet, not Hiera's general configuration.

 

 

Here's an example search or hiera good in the order of hierarchy:

My hierarchy is:


:hierarchy:

  - "node/%{fqdn}"

  - "virtual/%{virtual}"

  - "osfamily/%{osfamily}"

  - common

 



Very good, but Alfredo's hierarchy does not need to look like yours.
 
 

 

 

So check the following:

1 / verifies that the file points /etc/hiera.yaml of your file  /etc/puppet/hiera.yaml:

ls -rtla /etc/hiera.yaml

     /etc/hiera.yaml -> /etc/puppet/hiera.yaml

 

2 / Check the owners:

Chown puppet: puppet /etc/puppet/hiera.yaml

Chown -R puppet: puppet / etc / puppet / hieradata /

 



Hiera data files do not need to be owned by 'puppet' so long as 'puppet' can read them.  In fact, it is better for them to be owned by root and writable only by root, for, as a general rule, it is preferable for services to be unable to modify their own data and configuration.  That reduces the surface area accessible to malicious actors.


John

David Levray

unread,
Sep 9, 2015, 7:39:30 AM9/9/15
to Puppet Users
Hello,

Its configuration file is hiera.yaml, and path depends on how it is invoked, which can be one of the following ways:

-When Is invoked from puppet, the path will be: /etc/puppet/hiera.yaml
-When Is invoked from CLI or when used in the Ruby code: /etc/hiera.yaml

So you have to see for the rights.

The establishment of a hierarchy allows control over the deployment of modules. By including the package in the common file. The entire node receive packages. Hence the use of the hierarchy for that installed on one or more dedicated server for application.

The problem here is that it does not find the class PostgreSQL. We must therefore indicate the missing class.

Alfredo De Luca

unread,
Sep 28, 2015, 5:35:06 AM9/28/15
to puppet...@googlegroups.com
Hi David et all.

I didn't have that much time to investigate further but I tried only to have
postgresql::server in my xxxxxxx.xxx.xxx.yaml and it install the
default postgresql so not what I wanted.

So it looks like I can't use postgresql (or mysql) only with hiera.

Should I contact the team that published the module?

Thanks
Alfredo
> --
> 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/83b7272f-d037-40ba-bce4-27dccbf67176%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages