0

I#m trying to setup a VM with postgresql and gitlab. I'm using the following packages: gitlab & postgresql

This is my init.pp

class { 'postgresql::server':
  ip_mask_deny_postgres_user => '0.0.0.0/32',
  ip_mask_allow_all_users    => '0.0.0.0/0',
  listen_addresses           => '*',
  ipv4acls                   => ['host all johndoe 10.1.1.0/24 cert'],
  manage_firewall            => true,
  postgres_password          => 'TPSrep0rt!',
}

class { 
  'gitlab':
    git_email         => 'felix@psy-coding.com',
    git_comment       => 'GitLab Performates',
    gitlab_domain     => 'gitlab.foobar.fr',
    gitlab_dbtype     => 'pgsql',
    gitlab_dbname     => 'gitlab',
    gitlab_dbuser     => 'gitlab',
    gitlab_dbpwd      => 'gitlab',
    ldap_enabled      => false,
}

nearly copied form the examples

But when I try to provision my VM i always get

Error: Duplicate declaration: Package[postgresql-client] is already declared; cannot redeclare at /etc/puppet/modules/postgresql/manifests/client.pp:12 on node

I'm only referencing to postgresql::server and gitlab ensures that postgresql-client is installed so thy does it complain?

soupdiver
  • 807
  • 2
  • 9
  • 26
  • Pretty sure you want to remove postgres_password here and change it everywhere used ;) – zhenech Jan 13 '14 at 21:01
  • Can't say without seeing the code. Try commenting things out and see. Comment out the pgsql::server declaration and see if the catalog compiles. That will give you a clue as to where the dupe is. – Danila Ladner Jan 13 '14 at 21:02
  • @zhenech it is just the sample password from the modules example page so I won't use this pass ;) – soupdiver Jan 14 '14 at 10:15

1 Answers1

2

The problem here is, that you cannot define two resources with the same name in Puppet.

The PostgreSQL module defines the Package['postgresql-client'] here: https://github.com/puppetlabs/puppetlabs-postgresql/blob/master/manifests/client.pp#L8

And GitLab here: https://github.com/sbadia/puppet-gitlab/blob/master/manifests/setup.pp#L52

As GitLab uses the ensure_packages function from stdlib, this should work if postgres is loaded before gitlab, but with Puppet you do not ensure (heh, sorry) the order of module-loading.

A proper fix would be using ensure_packages in the PostgreSQL module too. You can either patch that locally, or workaround the double-definition by removing one of the postgresql-client package definitions.

zhenech
  • 1,492
  • 9
  • 13
  • thanks man! this helped me out! So is this a "fault" in the postgresql module and should be fixed or is it normal that these things happen? – soupdiver Jan 13 '14 at 22:34
  • 1
    These things happen, sadly. You could ask for a fix in the posgresql module (e.g. via the mentioned `ensure_packages` function from stdlib), but if I'd be the author, I would not consider this a show stopper (but certainly a nice to have feature). – zhenech Jan 14 '14 at 07:09
  • u say no show stopper but this stop the module from working properly with other modules and in my eyes this is a huge disadvantage or ?! – soupdiver Jan 14 '14 at 10:15
  • 1
    disadvantage, yes, but in a not-too-common case and one could also argue that gitlab does not actually need the postgresql client ("only" the ruby bindings and libpq). in any case, open a bug, let the authors decide. – zhenech Jan 14 '14 at 20:16