initdb error with puppet-postgresql module

718 views
Skip to first unread message

thinkwell

unread,
Jun 16, 2014, 7:16:51 PM6/16/14
to puppet...@googlegroups.com
Hello everyone,

I'm trying out the puppet-postgresql module (v. 3.3.3) on Rhel 5 & 6 machines, installing Postgresql 9.3. When installing manually from the repos, everything works as expected:

1. yum -y install postgresql93-server
2. service postgresql-9.3 initdb
3. service postgresql-9.3 start

However, when installing from puppet-postgresql, /var/lib/pgsql/9.3/data/pg_log/ gets created prematurely, so the puppet run fails with output like so:

Error: Could not start Service[postgresqld]: Execution of '/etc/init.d/postgresql-9.3 start' returned 1:
Error: /Service[postgresqld]/ensure: change from stopped to running failed: Could not start Service[postgresqld]: Execution of '/etc/init.d/postgresql-9.3 start' returned 1:
Notice: /Stage[main]/Postgresql::Server::Service/Postgresql::Validate_db_connection[validate_service_is_running]/Exec[validate postgres connection for /postgres]: Dependency Service[postgresqld] has failures: true
Warning: /Stage[main]/Postgresql::Server::Service/Postgresql::Validate_db_connection[validate_service_is_running]/Exec[validate postgres connection for /postgres]: Skipping because of failed dependencies
Notice: /Stage[main]/Postgresql::Server::Service/Anchor[postgresql::server::service::end]: Dependency Service[postgresqld] has failures: true


Manually running initdb gives this output:

[root@system ~]# /etc/init.d/postgresql-9.3 initdb
Initializing database: mkdir: cannot create directory `/var/lib/pgsql/9.3/data/pg_log': File exists


The only way around the problem is to manually delete the file and manually run initdb. After that, puppet runs succeed.
1. rm -rf /var/lib/pgsql/9.3/data/pg_log
2. service postgresql-9.3 start


If you just delete the file and re-run puppet, the pg_log director is again created prematurely.


Any help to fix this problem?

TIA,

thinkwell

thinkwell

unread,
Jun 16, 2014, 8:54:58 PM6/16/14
to puppet...@googlegroups.com
Well, I found the problem. The initdb command was failing with this error:

runuser: cannot set groups: Operation not permitted

So, the folder was created but not the default database. When I commented out user & group, the command worked on both Rhel 5 & 6. Is this a bug?

      exec { 'postgresql_initdb':
        command   => $initdb_command,
        creates   => "${datadir}/PG_VERSION",
        #user      => $user,
        #group     => $group,
        logoutput => true,
        #logoutput => on_failure,
        require   => File[$datadir],
      }


Hope it helps someone else.
Reply all
Reply to author
Forward
0 new messages