我正在尝试使用puppetlabs posgres模块安装Postgres,创建默认角色,并修复数据库以使用UTF8.
一切都运行和安装,但角色不会被创建.但是,如果我再次运行该配置,则会创建该角色.我想也许与执行顺序有关,但说实话,我迷路了.
这是我在清单文件中使用的代码.
user { "user_vagrant": ensure => "present",}->exec { 'apt_update': command => 'apt-get update',path => '/usr/bin/'}package { ['vim','postgresql-server-dev-9.1','libMysqLclIEnt-dev','nodeJs']: ensure => 'installed',before => Class['postgresql::server'],require => Exec['apt_update'],}class { 'postgresql::server': ip_mask_allow_all_users => '0.0.0.0/0',Listen_addresses => '*',ipv4acls => ['local all all md5'],postgres_password => 'postgres',require => User['user_vagrant'],}postgresql::server::role { 'vagrant': createdb => true,login => true,password_hash => postgresql_password("vagrant","vagrant"),require => Class['postgresql::server'],} ->exec { 'utf8_postgres': command => 'pg_dropcluster --stop 9.1 main ; pg_createcluster --start --locale en_US.UTF-8 9.1 main',unless => 'sudo -u postgres psql -t -c "\l" | grep template1 | grep -q UTF',path => ['/bin','/sbin','/usr/bin','/usr/sbin'],}解决方法 最后找到了正确的方法来修复应用的顺序和UTF8问题,迫使我尝试“pg_dropcluster”开始.顺便说一句,这是一个已知的问题,这是问题网址 http://projects.puppetlabs.com/issues/4695
这是我用来安装带有UTF8的Postgresql 9.1和RVM ruby的整个文件.希望这可以帮助.
模块:
– 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',require => User['vagrant']}->postgresql::server::role { 'vagrant': createdb => true,}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",require => Rvm_system_ruby["ruby-2.0.0-p247"]; }}class { 'rvm_install': require => User['vagrant'],}总结
以上是内存溢出为你收集整理的在Vagrant上使用Puppet配置PostgreSQL全部内容,希望文章能够帮你解决在Vagrant上使用Puppet配置PostgreSQL所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)