Puppetdb creates postgresdb but then fails to access it
Using puppetlabs-pupeptdb 3.0.1 with puppetlabs-postgresql 3.4.2, on Ubuntu 12.04 with Postgres 9.3.9 and the following manifest:
class {'java':
version => '8',
}
class { 'postgresql::globals':
manage_package_repo => true,
version => '9.3',
}
class {'::puppetdb':
ssl_listen_address => '0.0.0.0',
require => [ Class['java'], Class['Postgresql::Globals'], ],
}
class {'puppetdb::master::config':
require => Class['puppetdb']
}
I get the following error:
==> puppet.dev: Error: /Stage[main]/Puppetdb::Server::Validate_db/Postgresql::Validate_db_connection[validate puppetdb postgres connection]/Exec[validate postgres connection for localhost/puppetdb]/returns: change from notrun to 0 failed: echo 'Unable to connect to defined database using: /usr/bin/psql --tuples-only --quiet -h localhost -U puppetdb -p 5432 --dbname puppetdb ' && false returned 1 instead of one of [0]
i.e. Postgres gets installed and the user puppetdb
and the database get created alright (with password puppetdb
), but the command quoted above do not pass the password to psql
which seems to be the main issue.
Looking at the source code, I don't see a way for Puppet to pass the password to psql
.
When I login to the box I can authenticate with psql
using a password:
# /usr/bin/psql --tuples-only --quiet -h localhost -U puppetdb -p 5432 --dbname puppetdb
Password for user puppetdb:
puppetdb=> \l
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
puppetdb | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =T/postgres +
| | | | | postgres=CTc/postgres+
| | | | | puppetdb=CTc/postgres
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
Is there something I'm missing about the way I use the module?