尝试使用 Puppet 在 Ubuntu Trusty 上安装 PostgreSQL 9.5,使用所有文档我可以寻找,具有以下简单的类结构:
class { 'postgresql::globals':
manage_package_repo => true,
version => '9.5'
}
->
class { 'postgresql::server':
ip_mask_allow_all_users => '0.0.0.0/0',
listen_addresses => '*',
postgres_password => '',
encoding => 'UTF-8',
locale => 'en_US.UTF-8',
}
我遇到以下致命错误:
==> default: Debug: Automatically imported postgresql::server::database_grant from postgresql/server/database_grant into production
==> default: Error: validate_re(): "B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8" does not match ["\\A(0x)?[0-9a-fA-F]{8}\\Z", "\\A(0x)?[0-9a-fA-F]{16}\\Z"] at /tmp/vagrant-puppet/modules-964288a1df1d89c6bf2b0015dc43c600/apt/manifests/key.pp:60 on node vagrant.local
==> default: Error: validate_re(): "B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8" does not match ["\\A(0x)?[0-9a-fA-F]{8}\\Z", "\\A(0x)?[0-9a-fA-F]{16}\\Z"] at /tmp/vagrant-puppet/modules-964288a1df1d89c6bf2b0015dc43c600/apt/manifests/key.pp:60 on node vagrant.local
我努力了
添加package_name => 'postgresql-9.5'
到::globals
,无济于事。
在绝望的情况下,甚至:
exec {'Add postgresql 9.5 key':
command => '/usr/bin/wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo /usr/bin/apt-key add -',
user => 'root'
}
->
exec {'Add postgresql 9.5 apt':
command => '/bin/echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" >> /etc/apt/sources.list.d/postgresql.list',
user => 'root'
}
->
exec {'apt-get update':
command => '/usr/bin/apt-get update',
user => 'root'
}
->
class { 'postgresql::globals':
...
我注意到B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
与 postgresql 9.3 相对应:似乎某些内容没有按照正确的顺序进行更新。
答案1
最终发现这是由于傀儡模块过于过时造成的apt
。
将模块更新至apt 2.2.2匹配PostgreSQL 4.7.1(我已经有了)按照文档工作。