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. 





On Monday, June 16, 2014 7:16:51 PM UTC-4, thinkwell wrote:
>
> 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
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/d5c3eeef-2307-46e2-93c5-193415a954c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to