2013-08-10 15 views
7

私はpuppetモジュールpuppetlabs/postgresqlを使用しようとしています。私はそれを使用する方法について非常に混乱しています。誰でも私に例を挙げることができますか?ドキュメンテーションは設定を含むクラスを作成するように指示しますが、クラスを作成する場所がわからないため、site.ppを使用する印象を受けましたが、site.ppにクラスを作成すると、モジュールをインストールした後、次のブロックをsite.ppに入れます。puppetlabs/postgresqlの例が動作しない

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 
+1

注意:config_hash {}構造体は削除され、古い構文です。参照:https://github.com/puppetlabs/puppetlabs-postgresql#config_hash-parameter-collapsed-for-the-postgresqlserver-class – r3cgm

答えて

3

ベアの骨の形状(あなたがモジュールをインストールした後で):

node default { 
    include postgresql::server 

    postgresql::db { 'testdb': 
    user  => 'testdbuser', 
    password => 'testdbuser', 
    } 

} 

puppet parser validateあなたの友人が:-)

walks through the postgresql moduleかもしれないと人形のブログ上の記事がありますされます役に立った

あなたは両方を含む、およびクラスの使用を宣言している、掲示コードで
+5

これは 'postgresql :: db'ではなく、' postgresql :: 'に変更されました。サーバー:: db'。 – cevaris

5

:あなたは両方を行う必要がいけない

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

- サーバーに設定を適用したいしているとして、インクルード行を削除します。

+0

これは私のためのトリックでした。 :) – r3cgm

関連する問題