I have asked this question over at ask.puppet.com, but there has been no 
response at all. 

I did notice that there is a very old thread about this problem, but there 
was never any solution posted.

I'm hoping that Ken Barber is still on this list and can remember if he was 
able to help resolve this issue.

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 *validate_postgresql_connection.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':
    #postgres_password         => 'PASSWORD1',
    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 => 'PASSWORD2',
  }


and here is the debugging output...


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::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: Unable to connect to 
postgresql 

Debug: Exec[validate postgres connection for 
@:5432/postgres](provider=posix): Executing 'echo 'Unable to connect to 
defined database using: /usr/bin/psql --tuples-only --quiet    -p 5432 
 --dbname postgres ' && false' 

Debug: Executing with uid=postgres: 'echo 'Unable to connect to defined 
database using: /usr/bin/psql --tuples-only --quiet    -p 5432  --dbname 
postgres ' && false' 

Notice: 
/Stage[main]/Postgresql::Server::Service/Postgresql::Validate_db_connection[validate_service_is_running]/Exec[validate
 
postgres connection for @:5432/postgres]/returns: Unable to connect to 
defined database using: /usr/bin/psql --tuples-only --quiet    -p 5432 
 --dbname postgres 

Error: echo 'Unable to connect to defined database using: /usr/bin/psql 
--tuples-only --quiet    -p 5432  --dbname postgres ' && false returned 1 
instead of one of [0] 

Error: 
/Stage[main]/Postgresql::Server::Service/Postgresql::Validate_db_connection[validate_service_is_running]/Exec[validate
 
postgres connection for @:5432/postgres]/returns: change from notrun to 0 
failed: echo 'Unable to connect to defined database using: /usr/bin/psql 
--tuples-only --quiet    -p 5432  --dbname postgres ' && false returned 1 
instead of one of [0] 

Debug: Postgresql::Validate_db_connection[validate_service_is_running]: 
Resource is being skipped, unscheduling all events



Any help would be greatly appreciated

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/af44a569-a7eb-4370-b4b8-cf8a1a0ac2db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to