Provisioning PostgreSQL servers on CentOS with Puppet

One of the first things I wanted to do with Puppet was use it to build & configure postgres servers. Thanks to the excellent puppet docs I was able to get a crude recipe working easily enough but the stumbling block was the pg_hba.conf. I couldn’t get it to work without using the version of pg_hba.conf from the CentOS base repo.

It turned out to be a pretty simple permissions problem but for the sake of anyone else similarly stuck, here is the relevent bit of my modified pg_hba.conf:

# admin access for postgres user via sockets
local   all         postgres                          ident

Without that everything after initdb would fail.

Update: we’ve since replaced our initial recipe with a slightly modified version of this puppet-postgres module.