Ask Your Question
0

postgresql::globals gets ignored on ubuntu 14.04

asked 2016-12-01 09:41:26 -0500

Puppet master 2016.2.1 Puppet agent 4.5.3

Trying to configure postgres with non-default datadir and confdir on Ubuntu 14.04.

$postgres_data_directory_owner = "postgres"
$postgres_data_directory_group = "postgres"
$postgres_data_directory = "/pgsql-data"


  user { $postgres_data_directory_owner :
    ensure => 'present',
    before => File[$postgres_data_directory],
  }
  group { $postgres_data_directory_group :
    ensure => 'present',
    before => File[$postgres_data_directory],
  }

  file { $postgres_data_directory :
    ensure   => directory,
    owner    => $postgres_data_directory_owner,
    group    => $postgres_data_directory_group,
    require  => User[$postgres_data_directory_owner],
    before   => Class['postgresql::globals'],
  }
  class { 'postgresql::globals' :
    confdir              => "${postgres_data_directory}/data",
    datadir              => "${postgres_data_directory}/data",
    locale               => 'pl_PL.UTF-8', 
    needs_initdb         => true,
  }->
   class { 'postgresql::server': }

But after applying catalog i see postgres started with default values:

user1@u14c16db:~$ ps -ef | grep postgres
postgres  6099     1  0 12:25 ?        00:00:00 /usr/lib/postgresql/9.3/bin/postgres -D /var/lib/postgresql/9.3/main -c config_file=/etc/postgresql/9.3/main/postgresql.conf
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-12-01 11:45:02 -0500

lupin gravatar image

According to docs. you need to set additional parameter. needs_initdb = true

datadir

Note: Changing the datadir after installation causes the server to come to a full stop before making the change. On Ubuntu, you must explicitly set needs_initdb = true to allow Puppet to initialize the database in the new datadir (needs_initdb defaults to true on other systems).

Warning: If datadir is changed from the default, Puppet does not manage purging of the original data directory, which causes it to fail if the data directory is changed back to the original.

edit flag offensive delete link more

Comments

Hi I know this part of documentation and I already did set this parameter! Please look again at the code. However after your advice I even added new variables to manifest: $needs_initdb = true $datadir = "${postgres_data_directory}/data" But result is stil the same -invalid directories location

tomsmig gravatar imagetomsmig ( 2016-12-05 02:52:36 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-12-01 05:30:25 -0500

Seen: 20 times

Last updated: Dec 01 '16