Finally found the right approach to fix both the applied order, and the UTF8 issue which forced me to try the "pg_dropcluster" to begin with. Btw, this is a known issue here's the issue url http://projects.puppetlabs.com/issues/4695
This is the whole file I use to install PostgreSQL 9.1 with UTF8, and RVM ruby. Hope this helps.
Modules:
- puppetlabs/apt - 1.4
- puppetlabs/concat - 1.0
- puppetlabs/stdlib - 4.1.0
- puppetlabs/postgresql - 3.2
- blt04/puppet-rvm - git://github.com/blt04/puppet-rvm.git
stage { 'pre':
before => Stage['main']
}
class pre_req {
user { "vagrant":
ensure => "present",
}
exec { 'apt-update':
command => 'apt-get update',
path => '/usr/bin'
}->
exec { 'install_postgres':
command => "/bin/bash -c 'LC_ALL=en_US.UTF-8; /usr/bin/apt-get -y install postgresql'",
}
}
class { 'pre_req':
stage => pre
}
package { ['postgresql-server-dev-9.1']:
ensure => 'installed',
before => Class['postgresql::server']
}
class { 'postgresql::globals':
encoding => 'UTF8',
locale => 'en_US.UTF-8'
}->
class { 'postgresql::server':
stage => main,
locale => 'en_US.UTF-8',
ip_mask_allow_all_users => '0.0.0.0/0',
listen_addresses => '*',
ipv4acls => ['local all all md5'],
postgres_password => 'postgres',
require => User['vagrant']
}->
postgresql::server::role { 'vagrant':
createdb => true,
login => true,
password_hash => postgresql_password("vagrant", "vagrant"),
}
class rvm_install {
class { 'rvm': version => '1.23.10' }
rvm::system_user { vagrant: ; }
rvm_system_ruby {
"ruby-2.0.0-p247":
ensure => "present",
default_use => false;
}
rvm_gemset {
"ruby-2.0.0-p247@plyze":
ensure => present,
require => Rvm_system_ruby['ruby-2.0.0-p247'];
}
rvm_gem {
"puppet":
name => "puppet",
ruby_version => "ruby-2.0.0-p247",
ensure => latest,
require => Rvm_system_ruby["ruby-2.0.0-p247"];
}
rvm_gem {
"bundler":
name => "bundler",
ruby_version => "ruby-2.0.0-p247",
ensure => latest,
require => Rvm_system_ruby["ruby-2.0.0-p247"];
}
}
class { 'rvm_install':
require => User['vagrant'],
}