我正在尝试使用 puppet 模块 puppetlabs/postgresql。我很困惑如何使用它。任何人都可以给我一个例子吗?文档告诉使用设置创建类,但我不确定在哪里创建类,我的印象是使用 site.pp,但是当我在 site.pp 中创建一个类时。安装模块后,我将以下块放入 site.pp
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',
}
}
我收到很多错误。
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