Puppet / postgresql examples do not work

I am trying to use the puppetlabs / postgresql doll module. I am very confused about how to use it. Can anyone give me an example? the documentation says to create a class with settings, but I'm not sure where to create the class, I was impressed to use site.pp, but when I create the class in site.pp. I installed the following block in site.pp after installing the module

node default { # This is where you can declare classes for all nodes. # Example: # class { 'my_class': } include postgresql::server class { 'postgresql::server': config_hash => { 'ip_mask_deny_postgres_user' => '0.0.0.0/32', 'ip_mask_allow_all_users' => '0.0.0.0/0', 'listen_addresses' => '*', 'ipv4acls' => ['hostssl all johndoe 192.168.0.0/24 cert'], 'manage_redhat_firewall' => true, 'manage_pg_hba_conf' => false, 'postgres_password' => 'TPSrep0rt!', }, } postgresql::db { 'testdb': user => 'testdbuser', password => 'testdbuser' } postgresql::database_grant { 'testdbuser': privilege => 'ALL', db => 'testdbuser', role => 'dbo', } } 

I get a lot of errors.

 err: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Class[Postgresql::Server] is already declared; cannot redeclare at /etc/puppetlabs/puppet/manifests/site.pp:55 on node caaers warning: Not using cache on failed catalog err: Could not retrieve catalog; skipping run 
+7
puppet
source share
2 answers

Bare bones configuration (after installing the module):

 node default { include postgresql::server postgresql::db { 'testdb': user => 'testdbuser', password => 'testdbuser', } } 

puppet parser validate is your friend puppet parser validate

There is a post on the Puppet blog post that it is looking at the postgresql module , which may be useful.

+3
source share

In the code you posted, you both include and declare the use of the class:

 include postgresql::server class { 'postgresql::server': 

You do not need to do the same - since you want to apply the configuration to the server, I would remove the include line.

+5
source share

All Articles