Puppet fails on icinga2 using puppet-icinga2 module

I am trying to bring up a box for icinga2 using vagrant and
I am using puppet-icinga2 from https://github.com/Icinga/puppet-icinga2/tree/v0.6.2

so I have a role as shown below

class role::icinga2_server {

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           => 'localhost',
      postgres_password          => 'password',}

postgresql::server::db {
        'icinga2_data':
        user => 'icinga2',
        password => 'password'
}



class { 'icinga2::server':
      server_db_type => 'pgsql',
      db_host => 'localhost',
      db_port => '5432',
      db_name => 'icinga2_data',
      db_user => 'icinga2',
      db_password => 'password',
 }
}

So when I provision box I get postgres intall fine via puppet (using puppet-postgres module) then puppet throws errors on

==> centos7: Notice: /Stage[main]/Vagrant/Group[vagrant]/gid: gid changed '1000' to '500'
==> centos7: Debug: /Stage[main]/Vagrant/Group[vagrant]: The container Class[Vagrant] will propagate my refresh event
==> centos7: Debug: Exec[postgres_schema_load](provider=posix): Executing 'su - postgres -c 'export PGPASSWORD='\''password'\'' && psql -U icinga2 -h localhost -d icinga2_data < /usr/share/icinga2-ido-pgsql/schema/pgsql.sql' && export PGPASSWORD='' && touch /etc/icinga2/postgres_schema_loaded.txt'
==> centos7: Debug: Executing 'su - postgres -c 'export PGPASSWORD='\''password'\'' && psql -U icinga2 -h localhost -d icinga2_data < /usr/share/icinga2-ido-pgsql/schema/pgsql.sql' && export PGPASSWORD='' && touch /etc/icinga2/postgres_schema_loaded.txt'
==> centos7: Notice: /Stage[main]/Icinga2::Server::Install::Execs/Exec[postgres_schema_load]/returns: psql: could not connect to server: Connection refused
==> centos7: Notice: /Stage[main]/Icinga2::Server::Install::Execs/Exec[postgres_schema_load]/returns:   Is the server running on host "localhost" (::1) and accepting
==> centos7: Notice: /Stage[main]/Icinga2::Server::Install::Execs/Exec[postgres_schema_load]/returns:   TCP/IP connections on port 5432?
==> centos7: Notice: /Stage[main]/Icinga2::Server::Install::Execs/Exec[postgres_schema_load]/returns: could not connect to server: Connection refused
==> centos7: Notice: /Stage[main]/Icinga2::Server::Install::Execs/Exec[postgres_schema_load]/returns:   Is the server running on host "localhost" (192.168.10.131) and accepting
==> centos7: Notice: /Stage[main]/Icinga2::Server::Install::Execs/Exec[postgres_schema_load]/returns:   TCP/IP connections on port 5432?
==> centos7: Error: su - postgres -c 'export PGPASSWORD='\''password'\'' && psql -U icinga2 -h localhost -d icinga2_data < /usr/share/icinga2-ido-pgsql/schema/pgsql.sql' && export PGPASSWORD='' && touch /etc/icinga2/postgres_schema_loaded.txt returned 2 instead of one of [0]

I see errors stating psql cannot connect but when I bring my vagrant box up, ssh in I see postgres installed running and listening fine. I can also connect using psql but puppet fails at creating schema on postgres as seen on debug output.

I also did login and executed same command for postgres schema load and it did work fine.

Why puppet is failing to load schema?

Answer

The release versions of that module are really really old, and not very good either.

You should start by trying out our current development state, currently still in a branch called “develop”.

There are still some things todo until we reach a releasable state (in terms of cleanup and breaking changes).

You should have a look on the roadmap.

Attribution
Source : Link , Question Author : PoX , Answer Author : lazyfrosch

Leave a Comment