Puppetlabs_Postgres Module: validate_postgresql_connection.sh fails

asked 2016-06-03 14:22:30 -0600

jdehnert gravatar image

updated 2016-06-03 14:24:07 -0600

Greetings everyone,

System info:
OS: CentOS 6.7
Puppet Version: 4.5.0
Postgres Version: 9.4
Puppetlabs-Postgres Module Version: v4.7.1
Module Config: Listed Below
Configration Notes: Postgress is running on the same host as the puppetdb. There is no need for me to open the Postgres port to the internet for remote access.

I have been trying to get the puppetlabs-postgres module running, but I can't seem to get the validatepostgresqlconnection.sh to complete. From what I can see it runs this validation test, but Postgress replies with a password request and the script times out. I did see some mention of this issue in the puppet-users Google group back in mid 2015, but there was no resolution to the issue posted there.

I took a look at the validate_postgresql_connection.sh script, and its pretty simple with no space for a password to be passed to it.

Here I'm my module configuration:

# postgresql
############
  $postgres_version = '9.4'
  $postgres_package = '94'

  class { 'postgresql::globals':
    version          => "${postgres_version}",
    bindir           => '/usr/bin',
    confdir          => "/var/lib/pgsql/${postgres_version}/data",
  }

  class { 'postgresql::server':
    manage_pg_hba_conf        => true,
    service_restart_on_change => true,
    package_ensure            => true,
    datadir                   => "/var/lib/pgsql/${postgres_version}/data",
    package_name              => "postgresql${postgres_package}-server",
    client_package_name       => "postgresql${postgres_package}",
    service_name              => "postgresql-${postgres_version}",
    service_status            => "service postgresql-${postgres_version} status",
    service_reload            => "service postgresql-${postgres_version} reload",
    pg_hba_conf_defaults      => false,
  }

  class { 'postgresql::server::contrib':
    package_ensure => 'present',
    package_name   => "postgresql${postgres_package}-contrib",
  }

  postgresql::server::pg_hba_rule { 'local_access_postgres':
    type        => 'local',
    database    => 'all',
    user        => 'postgres',
    auth_method => 'peer',
  }

  postgresql::server::pg_hba_rule { 'local_access_puppetdb':
    type        => 'local',
    database    => 'puppetdb',
    user        => 'puppetdb',
    auth_method => 'peer',
  }

  postgresql::validate_db_connection { 'validate_local_puppetd_connection':
  database_host     => 'localhost',
  database_name     => 'puppetdb',
  database_username => 'puppetdb',
  database_port     => '5432',
  run_as            => 'puppetdb',
  database_password => PASSWORD',
  }

...and here is the debugging output of the error. I have truncated it a bit to save you from the 60 failed attempts of contact the database system:

Debug: Executing: 'service postgresql-9.4 status'
Debug: Executing: '/sbin/chkconfig postgresql-9.4'
Debug: Exec[validate postgres connection for @:5432/postgres](provider=posix): Executing check '/usr/local/bin/validate_postgresql_connection.sh 1 60 '/usr/bin/psql --tuples-only --quiet    -p 5432  --dbname postgres ''
Debug: Executing with uid=postgres: '/usr/local/bin/validate_postgresql_connection.sh 1 60 '/usr/bin/psql --tuples-only --quiet    -p 5432  --dbname postgres ''
Debug: /Stage[main]/Postgresql::Server::Service/Postgresql::Validate_db_connection[validate_service_is_running]/Exec[validate postgres connection for @:5432/postgres]/unless: 1
Debug: /Stage[main]/Postgresql::Server::Service/Postgresql::Validate_db_connection[validate_service_is_running]/Exec[validate postgres connection for @:5432/postgres]/unless: Password:
Debug: /Stage[main]/Postgresql::Server::Service/Postgresql::Validate_db_connection[validate_service_is_running]/Exec[validate postgres connection for @:5432/postgres]/unless: psql: FATAL:  password authentication failed for user "postgres"
...  *snip* 8< ...
Debug: /Stage[main]/Postgresql::Server::Service/Postgresql::Validate_db_connection[validate_service_is_running]/Exec[validate postgres connection for @:5432/postgres]/unless: psql: FATAL:  password authentication failed for user "postgres"
Debug: /Stage[main]/Postgresql::Server::Service/Postgresql::Validate_db_connection[validate_service_is_running]/Exec[validate postgres connection for @:5432/postgres]/unless: 60
Debug: /Stage[main]/Postgresql::Server::Service/Postgresql::Validate_db_connection[validate_service_is_running]/Exec[validate postgres connection for @:5432/postgres]/unless: sleeping
Debug: /Stage[main]/Postgresql::Server::Service/Postgresql::Validate_db_connection[validate_service_is_running]/Exec[validate postgres connection for @:5432/postgres]/unless: Password:
Debug: /Stage[main]/Postgresql ...
(more)
edit retag flag offensive close merge delete

Comments

I guess I am just going too have to re-write that script.

jdehnert gravatar imagejdehnert ( 2016-06-08 12:10:27 -0600 )edit