[TriLUG] n00b puppet question

Justin Parker xjparkerx at gmail.com
Thu Oct 23 17:23:34 EDT 2014


Thanks so much for your reply.  Your structure is essentially like my folder structure so I think I can apply the Postgres puppet code directly in one of the top level pp files.  Do you know How would I go about applying it from one of my own modules?

What I've been trying and doesn't seem to work is put in the foo.pp a node clause and include mymodule then in the mymodule/init.pp put your Postgres code??  Is that even close? 
Then to apply I'd do puppet apply foo.pp


Sent from something . . . 

> On Oct 23, 2014, at 3:44 PM, Igor Partola <igor at igorpartola.com> wrote:
> 
> Sure. So here's what I did:
> 
> 1. Download the tarball from here:
> https://forge.puppetlabs.com/puppetlabs/postgresql. I don't install puppet
> modules using their command line tool, but that's another story. Make sure
> to get all the dependencies from
> https://forge.puppetlabs.com/puppetlabs/postgresql/dependencies as well.
> 
> 2. My directory layout is generally like this (in the project root):
> 
> puppet/
>    manifests/
>        base.pp  - everything that goes into every server
>        foo.pp - setup for host foo
>        bar.pp - setup for host bar
> 
>    modules/
>        postgres/
>            the contents of the tarball
> 
>        mymodule/
>            manifests/
>                init.pp
>            templates/
>                template files
>            files/
>                static files
> 
> 3. Open up puppet/manifests/foo.pp (or base.pp, as the case may be). Add
> the following rules:
> 
>    # Make Postgres use UTF-8
>    class {
>        'postgresql::globals':
>            encoding => 'UTF8',
>            locale   => 'en_US.UTF8',
>            notify => Class['postgresql::server'];
>    }
> 
>    # Define a Postgres server
>    class {
>        'postgresql::server':
>            ip_mask_allow_all_users => '10.10.0.0/16', # If this will be
> networked.
>            listen_addresses => $ipaddress_eth0; # Set this appropriately
>    }
> 
>    # Various performance options. You'll have to read the docs for the
> Puppet Postgres module to know what these are
>    postgresql::server::config_entry {
>        'max_connections' : value => 255;
>        'lc_messages' : value => "en_US.UTF-8";
>        'lc_monetary' : value => "en_US.UTF-8";
>        'lc_numeric' : value => "en_US.UTF-8";
>        'lc_time' : value => "en_US.UTF-8";
>    }
> 
>    # Define your databases
>    postgresql::server::db {
>        'my-database-name':
>            user => 'my-database-username',
>            password => postgresql_password('my-database-username',
> 'super-secret-password');
> 
>        'my-second-database-name':
>            user => 'my-second-database-username',
>            password => postgresql_password('my-second-database-username',
> 'super-secret-password');
>    }
> 
>    # Create users.
>    postgresql::server::role {
>        'my-database-username':
>            password_hash => postgresql_password('my-database-username',
> 'super-secret-password''),
>            createdb => false;
> 
>        'my-second-database-username':
>            password_hash =>
> postgresql_password('my-second-database-username',
> 'super-secret-password''),
>            createdb => false;
> 
>    }
> 
> That's it. I think somewhere in there the double listing of users and
> passwords is unnecessary, but I know the above configuration works.
> 
> Igor
> -- 
> This message was sent to: Justin <xjparkerx at gmail.com>
> To unsubscribe, send a blank message to trilug-leave at trilug.org from that address.
> TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
> Unsubscribe or edit options on the web    : http://www.trilug.org/mailman/options/trilug/xjparkerx%40gmail.com
> Welcome to TriLUG: http://trilug.org/welcome


More information about the TriLUG mailing list